public static void Main() { RandomizedCollection obj = new RandomizedCollection(); bool param_1 = obj.Insert(val); bool param_2 = obj.Remove(val); int param_3 = obj.GetRandom(); }
public static void Main() { RandomizedCollection obj = new RandomizedCollection(); bool param_1 = obj.Insert(10); param_1 = obj.Insert(10); param_1 = obj.Insert(20); param_1 = obj.Insert(20); param_1 = obj.Insert(30); param_1 = obj.Insert(30); param_1 = obj.Remove(10); param_1 = obj.Remove(10); param_1 = obj.Remove(30); param_1 = obj.Remove(30); Console.WriteLine(obj.GetRandom()); Console.WriteLine(obj.GetRandom()); Console.WriteLine(obj.GetRandom()); Console.WriteLine(obj.GetRandom()); }
public void Execute() { RandomizedCollection obj = new RandomizedCollection(); bool param1 = obj.Insert(2); bool param12 = obj.Insert(2); bool param13 = obj.Insert(3); bool param14 = obj.Insert(1); bool param2 = obj.Remove(2); int param3 = obj.GetRandom(); }
public IEnumerable <string> Run(int a) { var set = new RandomizedCollection(); var result = new List <string>(); result.Add(set.Insert(1).ToString()); result.Add(set.Insert(1).ToString()); result.Add(set.Remove(1).ToString()); result.Add(set.GetRandom().ToString()); return(result); }
public void RandomizedCollectionTest() { RandomizedCollection rs = new RandomizedCollection(); bool result; int randonValue;// = rs.GetRandom(); result = rs.Insert(4); result = rs.Insert(3); result = rs.Insert(4); result = rs.Insert(2); result = rs.Insert(4); // randonValue = rs.GetRandom(); result = rs.Remove(4); result = rs.Remove(3); result = rs.Remove(4); result = rs.Remove(4); randonValue = rs.GetRandom(); // result = rs.Remove(1); }
static void Main(string[] args) { RandomizedCollection collection = new RandomizedCollection(); int rs; bool status; collection.Insert(1); collection.Insert(1); collection.Insert(2); collection.Insert(1); collection.Insert(2); collection.Insert(2); status = collection.Remove(1); Console.WriteLine($"Status: {status}"); status = collection.Remove(2); Console.WriteLine($"Status: {status}"); status = collection.Remove(2); Console.WriteLine($"Status: {status}"); status = collection.Remove(2); Console.WriteLine($"Status: {status}"); collection.GetRandom(); }
public void TestRandomizedCollection() { var rc = new RandomizedCollection(); rc.Insert(1); rc.Insert(1); rc.Insert(2); rc.Insert(1); rc.Insert(2); rc.Insert(2); rc.Remove(1); rc.Remove(2); rc.Remove(2); rc.Remove(2); Assert.IsTrue(rc.GetRandom() == 1); Assert.IsTrue(rc.GetRandom() == 1); Assert.IsTrue(rc.GetRandom() == 1); Assert.IsTrue(rc.GetRandom() == 1); Assert.IsTrue(rc.GetRandom() == 1); Assert.IsTrue(rc.GetRandom() == 1); }