public int TestPush(int[] elements) { CustomQueue <int> queue = new CustomQueue <int>(elements); queue.Push(1); return(queue.Count()); }
public int TestPeek(int[] elements) { CustomQueue <int> queue = new CustomQueue <int>(elements); queue.Pop(); queue.Push(1); return(queue.Peek()); }
void InitWave() { string[] curWave = waves[wave].Split(':'); foreach (string monster in curWave) { string[] info = monster.Split(' '); if (info[MONSTER_TYPE] == "interval") { monsters.Push(info[NUM_OF_MONSTER]); } else { for (int i = 0; i < int.Parse(info[NUM_OF_MONSTER]); i++) { monsters.Push(info[MONSTER_TYPE]); } } } }
public bool TestGetEnumenator(int[] elements, string expectedResult) { CustomQueue <int> queue = new CustomQueue <int>(elements); queue.Pop(); queue.Push(1); string result = ""; foreach (var i in queue) { result += i + " "; } return(expectedResult.Equals(result)); //return queue.Aggregate("", (current, i) => current + (i + " ")); }
public int solution(string S) { if (S.Length <= 1) { return(0); } int longestBalanced = 0; CustomQueue queue = new CustomQueue(); for (int i = 0; i < S.Length; i++) { queue.Push(S[i]); if (queue.GetCurrentLongest() > longestBalanced) { longestBalanced = queue.GetCurrentLongest(); } } return(longestBalanced); }
private void RegisterSimObject_Callback(int arrayPosition, bool addObject, StringBuilder classNameSpace, StringBuilder className) { _msimdict[arrayPosition] = null; _mAvailable.Push(arrayPosition); deletedcount++; }