Algorithm 2Sum, 3Sum, 4Sum ... x-Sum and their variants x-Sums are very famous interview question which can be solved using two pointers method. Today, we are going to take a deep dive on this topic. Let's do it!
Algorithm Deep copy a Linked List with random pointers If I ask you to deep copy a Linked List, it will be very simple but if the list contains random pointer, how would you do? In this post, I am providing both w/ and w/o hashmap solution. Read on to find out!
Algorithm Reverse nodes in k-group in Linked List We have learned about reversing the whole Linked List, reversing nodes from m to n in a Linked List, and now, we need to reverse nodes in k-group. Though the difficulty is set to hard, but the concept still applies. Read on to master it!
Algorithm Sorting a Linked List Can you sort a Linked List in O(nlogn) time without allocating new space? Sorting list is very similar to sorting array, you use divide and conquer method to sort and merge the lists. Read on to find out more!
Algorithm Can you reorder a Linked List? We all know how to find the middle node of a linked list, or reverse a linked list, or even merge two lists together. In this question, you will be doing all these at once! Read on to find out how!
Algorithm Can you rotate a Linked List by k places? Given a linked list, can you rotate the list by k places? The challenge is to reconnect the rotated list with the unrotated list. Read on to find out how!
Algorithm Find the cycle in a Linked List Can you find out if a linked list has cycle in it? If so, can you find out the node where the cycle begins? Read on to find out!
Algorithm Find the intersection of two Linked Lists If I am giving you two linked lists, will you be able to find where their intersection node is? Read on if you are interested!
Algorithm Reverse a Linked List Reverse a Linked List is the one of the most common operations on Linked Lists. Knowing how to reverse a linked list can almost solve 80% of linked list problems. So let's master it!
Algorithm Design a Binary Search Tree Iterator Design a Binary Search Tree Iterator which allows us to retrieve the next smallest number and check if there exists the next smallest number in the BST.
Algorithm Course Schedule Course schedule is one of the most famous interview questions of all time. The idea is to use topological sorting to find out if you can finish all courses.
Algorithm Topological sorting, do you really know it? Toplogical sorting is a very important topic in graph. One must know how toplogical sorting works before they can claim that they know how to do graph problems. New to this and ready? Let's go!
Algorithm Lowest Common Ancestor of Binary Tree Lowest Common Ancestor (LCA) is a very popular question in an interview. Not only you need to understand what LCA is, you will also need to know its application as well.
Algorithm Identify a Balanced Binary Tree Given a binary tree, can you determine whether it is a height-balanced binary tree? What methods can we apply on this question? Read on to find out!
Algorithm Search a 2D Matrix Search for a value in a matrix, given that matrix is sorted from left to right for each row and that first integer of each row is greater than the last integer of previous row.
Algorithm Subsets, Permutations, and Combination Sums Some classic backtracking/dfs problems walkthrough practice: subsets, permutations, and combination sums.
Algorithm Binary Tree Traversal: Preorder, Inorder, Postorder Getting a deeper understanding of how to traverse preorder, inorder and postorder binary tree in multiple ways.
Algorithm Find min/max value in rotated sorted array When given you a rotated sorted array, would you be able to find the minimum without going through all the elements? What about finding the maximum? Want to know more, then read on!
Algorithm Search in rotated sorted array Have you wondered how to perform a binary search on rotated search array? Read on if you wish to know!
Algorithm Implement a square root function? Do you know how to implement a square root function without using native library function? If not, please read on!
Algorithm Reverse an integer? Reverse string and integer are very popular questions in interview. It can be very simple but it could be very tricky if you don't get your head right.
Algorithm Swap nodes in pairs? Have you ever wondered how swapping two nodes in Linked List works? If you do, please read on!
Algorithm Asymptotic analysis... really, what is this? I am sure lots of us know what asymptotic analysis is, but how many of us really understand it and know how to describe the runtime or space complexity?
Algorithm Reverse a string? [Beginner] Can you do a reverse on string in place? What about do it both iteratively and recursively? Here's the solution!