# Interview Question 6: Validate Pop Sequence of Stack

Analysis and implementations (in linear time) are given to determine whether or not a pop sequence of stack is possible given a specific push sequence.

Read More
Learn, Share and Inspire

Analysis and implementations (in linear time) are given to determine whether or not a pop sequence of stack is possible given a specific push sequence.

Read More
I give a recursive implementation for K sum, so any K Sum Problems (2sum, 3sum, 4sum, etc) could be solved by the same code in a consistent way. And the lower bound Ω(n^ceil(k/2)) of the K sum problem is also given here just for your information, which is quite theoretical and research oriented.

Read More
I implemented and discussed the common approach which reduces 4sum to 3sum and then to 2sum with O(N^3) time. The hash based approach is also analyzed too and sophysicated details about implementation are given. Time complexity differs depending on the type of hash map we use, O(N^2logN) for tree ordered hash map, O(N^2) for unordered hash map.

Read More
In this post, we discuss a problem called "3Sum Closest problem" which is very similar to 3sum problem. The source code turns out to be simplified in less than 20 lines and sorting method again is adopted. One could treat this problem as a simple extended exercise for the 3sum problem.

Read More
I discussed and gave a sorting approach in time complexity O(N^2) to solve the 3sum problem without using set to filter out repeated triplets at the end. Approach based on hash is discussed too and several difficulties and concerns as well as solutions are raised up.

Read More