Tip 1 : Do Atleast 150 DSA Questions, I used to do striver's DSA Sheet.
Tip 2 : Do Atleast 2 Decent Projects
Tip 3 : Try to go as deep as possible in CS core subjects.
Tip 1 : Try put any prior internship experience if you have one, because they gave a lot weightage to that, I did summer internship in amazon which became my edge against all other candidates.
Tip 2 : Do Atleast 2 Decent Projects
Out of 600 Candidates only 40 were shortlisted after this round.




knightPosition: {3,4}
targetPosition: {2,1}

The knight can move from position (3,4) to positions (1,3), (2,2) and (4,2). Position (4,2) is selected and the ‘stepCount’ becomes 1. From position (4,2), the knight can directly jump to the position (2,1) which is the target point and ‘stepCount’ becomes 2 which is the final answer.
1. The coordinates are 1 indexed. So, the bottom left square is (1,1) and the top right square is (N, N).
2. The knight can make 8 possible moves as given in figure 1.
3. A Knight moves 2 squares in one direction and 1 square in the perpendicular direction (or vice-versa).
This problem can be seen as the shortest path in an unweighted graph. Therefore we use BFS to solve this problem.
We try all 8 possible positions where a Knight can reach from its position. If the reachable position is not already visited and is inside the board, we push this state into the queue with a distance 1 more than its parent state. Finally, we return the distance of the target position, when it gets pop out from the queue



1.Note that the array contains negative integers as well.
2. Also, note that every array contains a single fixed point.
Given Array = [-1, 1, 3, 5]
In the above example 'ARR[1]' == 1, so you need to return 1.
Step 1: Thought of linear search but time complexity was more than expected.
Step 2: Tried binary search, First check whether middle element is Fixed Point or not. If it is, then return it; otherwise if the index of middle + 1 element is less than or equal to the value at the high index, then Fixed Point(s) might lie on the right side of the middle point (obviously only if there is a Fixed Point). Similarly, check if the index of middle – 1 element is greater than or equal to the value at the low index, then Fixed Point(s) might lie on the left side of the middle point.
Timing : 10 AM
Topic : Pros and Cons about MathWorks EDG Program
40 People were shortlisted for this round and only 20 made it through to the next round.
Pros and Cons about MathWorks EDG Program
A female interviewer took my online technical round.
The round was focused around DSA, C++ and OOPS. She asked me 2 DSA Questions and Some questions on OOPS and C++. She focused a lot on pointers.
After this round 7 were shortlisted for next round out of 20.



For N = 1, there is only one sequence of balanced parentheses, ‘()’.
For N = 2, all sequences of balanced parentheses are ‘()()’, ‘(())’.
Step 1: Create a recursive function that accepts a string (s), count of opening brackets (o) and count of closing brackets (c) and the value of n.
Step 2: if the value of opening bracket and closing bracket is equal to n then print the string and return.
Step 3: If the count of opening bracket is greater than count of closing bracket then call the function recursively with the following parameters String s + “}”, count of opening bracket o, count of closing bracket c + 1, and n.
Step 4: If the count of opening bracket is less than n then call the function recursively with the following parameters String s + “{“, count of opening bracket o + 1, count of closing bracket c, and n.



Using Max-Heap:
Follow the below steps to solve the problem:
Build a Max Heap
Use Extract Max K times to get K maximum elements from the Max Heap
Time complexity: O(N + K * log(N))
She asked if we put 2 same elements in a max heap, then how would you pop them out, because both have the same priority now, I told her I will also keep track of the count for the same element, the one with the lower count (which was put first) will be popped first!
This was a Managerial round.
Out of 8 People, 2 were selected for the further rounds.
How do you do time management?
Have you ever shown your integrity(refuse to do a task as it was unethical according to you)?
How can you work under pressure?
How do you prioritize your work?
How do you handle multiple deadlines?
How do you convince people?
How do you work/lead in a team?
How do you learn(books, videos, blogs)?
Location and domain preferences( and why).
This was a HR round.
After all the 5 rounds, Out of 600 Candidates that applied for this company's placement drive, Only 1 was selected. That was ME!
• Introduction
• Why Mathworks?
• Location preference.
• Family background.
• What do you know about us?
• About job role.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?