コード例 #1
0
        public static void ExtraBrackets()
        {
            StackQueueQ stackQueue = new StackQueueQ();

            Assert.That(stackQueue.Braces("(a+b)") == 0);
            Assert.That(stackQueue.Braces("((a+b))") == 1);
            Assert.That(stackQueue.Braces("((a+b)+c}") == 0);
            Assert.That(stackQueue.Braces("(a)") == 1);
        }
コード例 #2
0
        public void PrevSmaller()
        {
            //Input: A: [4, 5, 2, 10, 8]
            //Return: [-1, 4, -1, 2, 2]
            var res = StackQueueQ.PrevSmaller(new List <int>()
            {
                4, 5, 2, 10, 8
            });

            Assert.That(res[2] == -1);
            Assert.That(res[3] == 2);
            Assert.That(res[4] == 2);
        }