Tip 1 : Create a timetable and set goals. Keep aside 3-4 hours for studying. Consistency is the key.
Tip 2 : Do atleast 2 projects
Tip 3 : Know the complexities of the code that you’ve written.
Tip 1 : Do not put false things on resume.
Tip 2 : You should have good projects to showcase.
Timing: 7 pm
1) From any cell you can move UP, DOWN, LEFT, or RIGHT.
2) You cannot move out of the grid.
I Used Dynamic Programming to solve it.
1. The matrix may also contain some negative elements.
2. A square matrix is a matrix with the same number of rows and columns.
A matrix obtained by deleting some (possibly zero) of the rows and/or columns from the beginning and/or from the end of a matrix is said to be a sub-matrix of the given matrix.
Example: Given a matrix
A = 1 2
3 4
Possible non-empty sub-matrices of A are represented below by bold numbers-
I used HashMap to solve it.
Timing : 2 pm
The interviewer was very friendly.
Input: Consider the binary tree A as shown in the figure:
Output: [10, 5, 3, 7, 18, 25, 20]
Explanation: As shown in the figure
The nodes on the left boundary are [10, 5, 3]
The nodes on the right boundary are [10, 20, 25]
The leaf nodes are [3, 7, 18, 25].
Please note that nodes 3 and 25 appear in two places but are considered once.
Step 1 : I first applied vertical traversal and store it in a hashmap and print boundary element of each value in the hashmap.
Step 2 : He asked me the time complexity and space complexity.
Step 3 : He asked to optimise the solution and gave some hints.
Step 4 : I wasn't able to think at that points but he was expecting something using recursion.
The given singly linked list is 6 -> 5 -> 3 -> 4 -> 7 -> 1 -> 2
The modified linked list should have all even values in starting and odd values in the end.
Step 1 : I told him to create two linkedLists. One for odd elements and another for even elements. and while traversing the given list adding elements to even and odd lists respectively.
Step 2 : He asked me to optimise the space complexity.
Step 3 : I told him to change the list in place which will be taking O(1) complexity.
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Suppose list1 is [2, 133, 12, 12], what is max(list1) in Python?