** Inserts a value to the set. Returns true if the set did not already contain the specified element. */
(val int)
| 26 | |
| 27 | /** Inserts a value to the set. Returns true if the set did not already contain the specified element. */ |
| 28 | func (this *RandomizedSet) Insert(val int) bool { |
| 29 | if _, ok := this.valsSet[val]; !ok { |
| 30 | this.valsSet[val] = valEl{val: val, ind: len(this.vals)} |
| 31 | this.vals = append(this.vals, val) |
| 32 | return true |
| 33 | } |
| 34 | return false |
| 35 | } |
| 36 | |
| 37 | /** Removes a value from the set. Returns true if the set contained the specified element. */ |
| 38 | func (this *RandomizedSet) Remove(val int) bool { |
nothing calls this directly
no outgoing calls
no test coverage detected