publicclassQueueUsingTwoStacks { staticclassQueue { staticStack<Integer>s1=newStack<>(); staticStack<Integer>s2=newStack<>(); publicstaticbooleanisEmpty() { returns1.isEmpty(); } // add ==> O(n) publicstaticvoidadd(intdata) {
0231-power-of-two Time: 0 ms (100.00%), Space: 7.2 MB (39.77%) - LeetHub Feb 19, 2024 0232-implement-queue-using-stacks Time: 3 ms (38.43%), Space: 7.3 MB (9.55%) - LeetHub Sep 14, 2023 0234-palindrome-linked-list Time: 188 ms (26.09%), Space: 130.8 MB (18.21%) - Leet...
Queue Sum_of_Min_Max_in_Window.cpp file added Jun 27, 2022 Recursion Recursion Print Increasing SubSequence files added Jan 20, 2023 Segment Trees Bit Manipulation Mar 22, 2023 Sparse Matrix Sudoku_Solver.cpp file added Nov 23, 2022 Stacks Infix_to_Prefix.cpp file added Jun 20, 2022 String...