Untitled

 avatar
unknown
plain_text
6 months ago
962 B
3
Indexable
{
  "ts-node": {
    "transpileOnly": true, // you can specify ts-node options here
    "compilerOptions": {
      "module": "commonjs", // you can also override compilerOptions.  Only ts-node will use these overrides
    }
  },
  "compilerOptions": {
    "module": "esnext", // tsc will continue to use these options
    "lib": ["es6"]
  }
}

class RandomizedSet {
    set: Set<number>;

    constructor() {
        this.set = new Set();
    }

    insert(val: number): boolean {
        if(this.set.has(val)){
            return false;
        }

        this.set.add(val)
        return true
    }

    remove(val: number): boolean {
        return
    }

    getRandom(): number {
        return
    }
}

/**
 * Your RandomizedSet object will be instantiated and called as such:
 * var obj = new RandomizedSet()
 * var param_1 = obj.insert(val)
 * var param_2 = obj.remove(val)
 * var param_3 = obj.getRandom()
 */
Editor is loading...
Leave a Comment