* Returns true if every element of this set is also in otherSet. * @param otherSet - The potential superset * @returns Whether this set is a subset of otherSet * @complexity Time O(n) | Space O(1)
(otherSet: MySet)
| 154 | * @complexity Time O(n) | Space O(1) |
| 155 | */ |
| 156 | isSubsetOf(otherSet: MySet): boolean { |
| 157 | if (this.size > otherSet.size) { |
| 158 | return false; |
| 159 | } |
| 160 | return this.values().every(value => otherSet.has(value)); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Returns true if every element of otherSet is also in this set. |
no test coverage detected