Tip 1 : Practice on coding platforms like Leetcode, GFG etc.
Tip 2 : Have a clear understanding of all core subjects.
Tip 3 : Do atleast 2 projects.
Tip 1 : Make a short 1 page resume.
Tip 2 : Focus more on work experience, projects and skills.
The interviewer started with basic introduction and then moved to discussing 2 coding problems.



The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.
Basic Insight:
An element of the array can store water if there are higher bars on the left and right. The amount of water to be stored in every element can be found out by finding the heights of bars on the left and right sides. The idea is to compute the amount of water that can be stored in every element of the array.
Algorithm:
Create two arrays left and right of size n. create a variable max_ = INT_MIN.
Run one loop from start to end. In each iteration update max_ as max_ = max(max_, arr[i]) and also assign left[i] = max_
Update max_ = INT_MIN.
Run another loop from end to start. In each iteration update max_ as max_ = max(max_, arr[i]) and also assign right[i] = max_
Traverse the array from start to end.
The amount of water that will be stored in this column is min(a,b) – array[i],(where a = left[i] and b = right[i]) add this value to total amount of water stored
Print the total amount of water stored.



Suppose given input is "abacb", then the length of the longest substring without repeating characters will be 3 ("acb").
The brute force approach would be to consider all substrings one by one and check for each substring whether it contains all unique characters or not. There will be n*(n+1)/2 substrings. Time complexity of this solution would be O(n^3).
For an efficient solution, a hashmap can be used. Maintain a hashmap which stores the characters in string as keys and their indexes(positions) as values, and keep two pointers which define the max substring. move the right pointer to traverse through the string, and meanwhile update the hashmap. If the character is already in the hashmap, then move the left pointer to the right of the same character last found. Keep updating the max length Non-Repeating Character Substring seen so far.
This was also a data structure based round. A long discussion went on the first question. However, I was not able to solve the complete question.



Input: Let the binary be as shown in the figure:
Output: Linked List: 15 -> 40 -> 62 -> 10 -> 20 -> NULL
Explanation: As shown in the figure, the right child of every node points to the next node, while the left node points to null.
Also, the nodes are in the same order as the pre-order traversal of the binary tree.
I was not able to solve this question.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?