"Minimum number of paranthesis to remove", "1.create set to store indexes of elements to remove 2.Create stack, to balance out the paranthesis 3. push to stack if ( is encountered, pop if ) is encountered 4.If stack size = 0 and ) is encountered, add to indexes to remove 5. Finally add all the elements in stack to indexesToRemove" "SubArray of contiguous subarray sum = K", "1. Create HashMap with sum, count of number of times encountered 2. At an element, if sum-k is present, it means, there are some elements whose sum is K, in that case, increment result with that count of sum. 3.Finally return result" "Next Permutation", "1. Find the pair next to each other in non increasing order from last to 1st. call this startIndex 2. From startIndex, go till end of string, to find a number, just greater than this.endIndex 3. Swap startIndex number and endIndex 4. Reverse String from startIndex+1 to end of string" "LCA of Btree Recursion", "If node == null return, if node == left or right, return node leftLca = rightLca = if(leftLca = null) return right if(rightLca = null) return left return node;"
Download CSV