Tip 1 : Solve DSA Maximum questions as you can
Tip 2 : Candidate should have basic knowledge on system design and OS
Tip 1 : Do not put unnecessary things which will make you in trouble.
Tip 2 : Practice what you preach
It was started in afternoon 2 PM. and started with my introduction and later he has asked me about my college final year project and I'm Electronics branch student and i obviously didn't make any project related to IT but my final year project was on Embedded and he was impressed on my roll in project seems like he was listening some new thing and after that about my past company project and he moved on coding question and asked me about recursion, string and pointer related question.
A palindrome is a word, number, phrase, or other sequences of characters which read the same backwards and forwards.
If the input string happens to be, "malayalam" then as we see that this word can be read the same as forward and backwards, it is said to be a valid palindrome.
The expected output for this example will print, 'true'.
A string is palindrome if it remains the same on reading from both ends. I've find the length of string and run loop and comparing character from first and last one by one.
1. You can return the list of values in any order. For example, if a valid triplet is {1, 2, -3}, then {2, -3, 1}, {-3, 2, 1} etc is also valid triplet. Also, the ordering of different triplets can be random i.e if there are more than one valid triplets, you can return them in any order.
2. The elements in the array need not be distinct.
3. If no such triplet is present in the array, then return an empty list, and the output printed for such a test case will be "-1".
It was started at 10 AM and completed at 10:45 AM around, in between it was completely DSA algorithm and I noticed one thing in 2nd round interview that, according to interviewer perspective, if candidate has less knowledge on past project that was okay for him but candidate should must have DSA knowledge and based on that he was judging skill. and he asked me 4 program about tree and Hashmap related question and i couldn't able to solve 2 of them and it was bit difficult for me
Height of a tree is the maximum number of nodes in a path from the node to the leaf node.
An empty tree is a height-balanced tree. A non-empty binary tree is a height-balanced binary tree if
1. The left subtree of a binary tree is already the height-balanced tree.
2. The right subtree of a binary tree is also the height-balanced tree.
3. The difference between heights of left subtree and right subtree must not more than ‘1’.
Input: Consider the binary tree given below:
Output: 'true'
Explanation:
Consider subtree at Node ( 7 )
Left subtree height is ‘0’ and right subtree height is ‘0’, the absolute height difference is ‘0-0 = 0’ and ‘0’ is not more than ‘1’ so subtree at Node ( 7 ) is a height-balanced binary tree.
Same for subtrees at Nodes ( 5, 6 ).
Consider subtree at Node ( 4 )
Left subtree height is ‘1’ and right subtree height is ‘0’, the absolute height difference is ‘1-0 = 1’ and ‘1’ is not more than ‘1’ so subtree at Node ( 4 ) is a height-balanced binary tree.
Same for subtree at Node ( 3)
Consider subtree at Node ( 2 )
Left subtree height is ‘2’ and right subtree height is ‘1’, the absolute height difference is ‘2-1 = 1’ and ‘1’ is not more than ‘1’ so subtree at Node ( 2 ) is a height-balanced binary tree.
Consider subtree at Node ( 1 )
Left subtree height is ‘3’ and right subtree height is ‘2’, the absolute height difference is ‘3-2 = 1’ and ‘1’ is not more than ‘1’ so subtree at Node ( 1 ) is a height-balanced binary tree.
Because the root node ( 1 ) is a height-balanced binary tree, so the complete tree is height-balanced.
Find height of left and right subtrees using dfs traversal. Print true if the difference between heights is not more than 1 and left and right subtrees are balanced, otherwise print false.
Let’s say you have a binary tree as follows:-
You do not need to print anything; it has already been taken care of. Just implement the function.
first to traverse the tree, starting from root till every node, check if its left subtree is a leaf. If it is, then add it to the result.
1. A word is a sequence of one or more lowercase characters.
2. Words are separated by a single whitespace character.
For the given string 'A' = “coding ninjas coding ninjas” and 'B' = “data structures and algorithms”, so both the word 'coding' and 'ninjas' are not present in string 'B' and occur two times each, but the word “coding” is lexicographically smaller than the word “ninjas”. So the answer is “coding”.
It was 30 minute interview, started at 11 AM. and interviewer asked me less question of DSA and more on system design.
In the given linked list, there is a cycle, hence we return true.
HR Round
Tell me about yourself.
Why do you want to join us?
Where do you see yourself in 5-10 years?
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which array operation has O(n) worst-case time complexity?