Tip 1 : Regular coding practice
Tip 2 : Do basic to hard level projects
Tip 3 : Theoretical knowledge not enough, do hands on.
Tip 1 : Mention what you have really done
Tip 2 : Projects are important, internships are not



‘ACE’ is a subsequence of ‘ABCDE’ because ‘ACE’ can be formed by deleting ‘B’ and ‘D’ without changing the relative order of characters. ‘ADB’ is not a subsequence of ‘ABCDE’ because we can get ‘ABD’ from ‘ABCDE’ but not ‘ADB’ and in ‘ADB’ relative order of ‘B’ and ‘D’ are different from original strings.
1.Strings ‘STR1’ and ‘STR2’ consists only of English uppercases.
2.Length of string ‘STR2’ will always be greater than or equal to the length of string ‘STR1’.
For example, the given ‘STR1’ is ‘BAE’ and ‘STR2’ is ‘ABADE’.
String ‘STR1’ is a subsequence of string ‘STR2’ because ‘BAE’ can be formed by deleting ‘A’ and ‘D’ from ‘ABADE’ and the relative ordering of the characters of the string ‘ABADE’ persists.

- Create a 3-dimensional (say elements[])array to store the frequency of each character of the strings upto each index.
- Traverse all the strings and find the frequency and store them
- Now check for the relative positions of the characters of a query.
- To implement this efficiently, iterate through the array of strings, compare the adjacent strings and do the following:
-- Find the relative position of each character with respect to every other character in the English alphabet (relative position is checked by checking the frequencies of all other characters till that index).
-- If they are not the same for a character (say ch) in two strings, add the characters which are causing the mismatch in a set. (mismatch means frequency counts are not the same)
-- Check if the mismatches found are the same as the characters of the query.
-- If so then the subsequences formed are not the same. So return false.
- After the iteration is over and a “false” is not returned, then subsequences formed are the same.



A path may or may not start at the root of the tree. A path may or may not end on a leaf node. You are allowed to travel only downwards. This means after visiting any node, you are allowed to visit only its children.
- Initialize an array, say answer[] of size N + 1 to store the values assigned to the nodes.
- Initialize a variable, say K as 1 to assign values to each node.
- Initialize a queue that is used to perform BFS Traversal on the given tree and push node with value 1 in the queue and initialize the value to the nodes as 1.
- Iterate until then the queue is non-empty and perform the following steps:
- Pop the front node of the queue and if the value assigned to the popped node is 1 then update the value of K to 2. Otherwise, update K as 1.
- Traverse all the child nodes of the current popped node and push the child node in the queue and assigned the value K to the child node.
- After completing the above steps, print the values stored in the array answer[] as the result.




1. For a rectangle, its top left and bottom right coordinates are given.
2. Coordinates of the rectangles are integer values.
3. Edges of the given rectangles will always be parallel to the X and Y coordinate axes of the cartesian plane.
4. It is guaranteed that both the rectangles will have at least a unit area.
1. The left edge of A is to the right of the right edge of B. In this case, the first rectangle A is completely on the right side of second rectangle B .
2. right edge of A is to the left of the left edge of B. In this case, the first rectangle A is completely on the left side of second rectangle B.
3.Top edge of A is below the bottom edge of B. In this case, the first rectangle A is completely under second rectangle B
4. Bottom edge of A is above the top edge of B. In this case, the first rectangle A is completely above second rectangle B

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?