Started with online test at Hackerearth. It had 2 questions.
- Find subarray with max sum. Array have both -ve and +ve integers.
- Consider a matrix with rows and columns, where each cell contains either a 0 or a 1 and any cell containing a 1 is called a filled cell. Two cells are said to be connected if they are adjacent to each other horizontally, vertically, or diagonally;
If one or more filled cells are also connected, they form a region.
Output the length of the largest region.
Ex: in the following example, there are 2 regions one with length 1 and the other as 6.
0 0 1 1 0
1 0 1 1 0
0 1 0 0 0
0 0 0 0 1
Solution: Unit Area of largest region of 1’s
1st Round (telephonic)
- Given a string and integer k, in-place rearrange the string such that last n-k characters comes before the first k characters.
Ex: abcdef and k=3, so result is: defabc
- Given a binary tree, sum all the root to leaf nodes and return the sum.
Ex: 1 / \ 2 3 / \ \ 4 6 7 here ans: 124 + 126 + 137 = 387
- Given a large file having strings(for understanding, given an array of strings). Find the string which repeats the most. Ignore the case.
- Given the link-list and integer value ‘k’, reverse every k nodes of the list.
Ex. k = 3, list: 1-2-3-4-5-6-7-8
- Questions on my projects.
- Given a binary tree with each node having parent pointers. Find the LCA of two nodes.
- Given a 2-D grid, number of steps to take, say k and intial position of a Robot. print the paths possible from initial position after k steps. Robot can move in top, right, left, bottom. In one path, robot can’t move to the location it has previously visited.
- Check if a binary tree is balanced. Balance criteria was difference of height between left and right subtree should be <= 1.
- Given a binary tree, a node of that tree, and integer k. Print all the nodes which are at distance k from that node. NOTE: there is no parent pointer in the node.
- Behavioral Questions. Read front pages(before technical stuff) of Cracking the coding interview book. Prepare them well.
- Given a string, count all the palindromes in that string. Only consider substring palindromes
Thanks to geeksforgeeks for helping me prepare for interviews.
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.