Tip 1 : Be Strong with DSA
Tip 2 : Be Strong with OOPS and Core CS Fundamentals
Tip 1 : One Page Resume
Tip 2 : Highlight your coding profiles
Tip 3 : Add your achievements and internships
Online Assessment



Conditions for valid parentheses:
1. All open brackets must be closed by the closing brackets.
2. Open brackets must be closed in the correct order.
()()()() is a valid parentheses.
)()()( is not a valid parentheses.
Algorithm:
Declare a character stack S.
Now traverse the expression string exp.
If the current character is a starting bracket (‘(‘ or ‘{‘ or ‘[‘) then push it to stack.
If the current character is a closing bracket (‘)’ or ‘}’ or ‘]’) then pop from stack and if the popped character is the matching starting bracket then fine else brackets are not balanced.
After complete traversal, if there is some starting bracket left in stack then “not balanced”



Let there be three jobs ‘A’, ‘B’, and ‘C’-
•Profit and deadline associated with job ‘A’ being 20 and 1.
•Profit and deadline associated with job ‘B’ being 30 and 2.
•Profit and deadline associated with job ‘C’ being 40 and 2.
We will perform job ‘C’ at time t = 1 and job ‘B’ at time t = 2. The total profit will be 70. There is no other sequence of jobs which can fetch us a better overall profit.
In this round one average puzzle and one DSA question was asked
(100 Doors)
There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in the following way:
In the first walk, the person toggles every door
In the second walk, the person toggles every second door, i.e., 2nd, 4th, 6th, 8th, …
In the third walk, the person toggles every third door, i.e. 3rd, 6th, 9th, …
Likewise,
In the 100th walk, the person toggles the 100th door.
Which doors are open in the end?
A door is toggled in an ith walk if i divide door number. For example, door number 45 is toggled in the 1st, 3rd, 5th, 9th,15th, and 45th walks.
The door is switched back to an initial stage for every pair of divisors. For example, 45 is toggled 6 times for 3 pairs (5, 9), (15, 3), and (1, 45).
It looks like all doors would become closed at the end. But there are door numbers that would open, for example, in 16, the divisors are (1,2,4,8,16) and as the pair(4,4) contributes only one divisor making the number of divisors odd, it would become open at the end. Similarly, all other perfect squares like 4, 9,…, and 100 would become open. Now, for prime numbers like 2,3,5,7… the divisors are (1, that number) and it is a pair, so they will remain closed at the end. And for all other numbers divisors are always in pairs, e.g. 15 = (1,15),(3,5), they will also remain closed.
So the answer is 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100.



Input: 'a' = [7, 12, 1, 20]
Output: NGE = [12, 20, 20, -1]
Explanation: For the given array,
- The next greater element for 7 is 12.
- The next greater element for 12 is 20.
- The next greater element for 1 is 20.
- There is no greater element for 20 on the right side. So we consider NGE as -1.
The worst case occurs when all elements are sorted in decreasing order. If elements are sorted in decreasing order, then every element is processed at most 4 times.
Initially pushed to the stack.
Popped from the stack when next element is being processed.
Pushed back to the stack because the next element is smaller.
Popped from the stack in step 3 of the algorithm.
It was a DSA based round. 2 medium level questions were asked in this round



If the given array is [2, 1, 5, 7] and K = 9 and M = 3. Then you need to return true because we can divide the array into two pairs, i.e (2, 1) and (5, 7) whose sums are 3 and 12, which when divided by 9 gives remainder 3, thus it is possible to divide the given array into pairs.
Every element of the array should contribute to only one pair, i.e if the array is [3, 0, 0] and K = 2 and M = 1, then you need to return false, as element 3 will make a pair with any one of the 0.
Traverse and check for the number of car cross overs in the array



Use DFS to find the number of islands
Managerial Round (Bar Raiser)



Algorithm:
Create the graph using the given number of edges and vertices.
Create a recursive function that initializes the current index or vertex, visited, and recursion stack.
Mark the current node as visited and also mark the index in recursion stack.
Find all the vertices which are not visited and are adjacent to the current node. Recursively call the function for those vertices, If the recursive function returns true, return true.
If the adjacent vertices are already marked in the recursion stack then return true.
Create a wrapper class, that calls the recursive function for all the vertices and if any function returns true return true. Else if for all vertices the function returns false return false.

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?