Free Post Coding Find all occurrences of a given word in a matrix We use the DFS on each word and try to form a word across eight neighbors.
Free Post Coding Find the continuous pattern in a given string String formation from substring. This approach is based on the preprocessing for the KMP using the LPS (longest possible suffix which is also a prefix)
Free Post Coding Find the length of the largest region in Boolean Matrix Union Find to the rescue. Also known as Unit Area of largest region of 1's and Max Area of island and size of the biggest cluster in the image.
Free Post Coding 149. Max Points on a Line Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. The approach uses the idea of considering each point as origin and calculating the slope with every other point.
Free Post Coding Minimum steps to reach the target by a Knight The idea is to use the BFS based on the limited set of possible moves the Knight can go across each direction. We traverse like a spider and return the number of moves as soon as we reach the target.
Free Post Coding Reverse the words of a string There can be an approach based on converting string to Char Array, reverse the array and then reverse each word while cleaning spaces. Another approach can be to use the library methods to split and reverse.
Free Post Coding Top View of Binary Tree Given below is a binary tree. The task is to print the top view of binary tree. We can store the track of range and depth during traversal along with map.
Free Post Coding Largest Rectangular area in a histogram Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
Free Post Coding Longest repeating non-overlapping substring Given a string str, find the longest repeating non-overlapping substring in it. We can take the DP approach or the LPS (Longest possible suffix which is also a prefix and preprocessing of KMP algorithm)
Free Post Coding Leaders in an array Print all the leaders in an array. An element is a leader if it's greater than all the elements to it's right (the rightmost element is always a leader).
Free Post Coding Merge K Sorted Arrays We think of the Merge operation in the Merge Sort to merge two sorted arrays into one. Also use the Min Heap approach to optimize.
Free Post Coding 236. Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
Free Post Coding 116. Populating Next Right Pointers in Each Node (LeetCode) Connect nodes at the same level: Write a function to connect all the adjacent nodes at the same level in a binary tree.
Free Post Coding Clone a Linked List with a next and random pointer Given a double linked list with one pointer pointing to the next node similar to single linked list. The second pointer can point to any node in the linked list. We have to write a program in O(n) time.
Free Post Coding Program to print the last N lines Given the string, we have to print the last N lines (known problem to print last 10 lines). If number of lines is less than N, then print all lines.