Tip 1: Most companies ask questions directly from popular SDE sheets in interviews, so revise those questions repeatedly.
Tip 2: If you're comfortable with all the topics, try solving random medium-level problems from coding platforms. Initially, you may struggle, but over time you will be able to solve unfamiliar problems and identify patterns, which will help you prepare for OAs.
Tip 3: Participate in weekly and biweekly contests on different coding platforms.
Tip 1: Make sure you do not include projects in your resume that can be easily created by an LLM in one or two prompts.
Tip 2: Even if you have clone-type projects, ensure that you have added some unique features to them.
It was an on-campus opportunity. The OA was conducted in the classroom.

Initially, I solved it in a straightforward way by fully decoding the entire string. I iterated through the encoded string and identified whether the current part represented a single-digit number or a two-digit number followed by 'x'.
I then converted that number into the corresponding character. If there was a [k] after it, I repeated that character k times. I kept appending all decoded characters to a new string.
Once I had the fully decoded string, I counted the frequency of each character using an array of size 26.
All the test cases passed (15/15).

At first, I thought of trying all possible combinations of broken edges.
The idea was to try different subsets of edges to repair. For each subset, I would check if the graph becomes fully connected. If it did, I would calculate the total repair cost and take the minimum among all such valid combinations. To check connectivity, I used BFS each time.
This was a brute-force approach, and I could not solve it optimally. It passed only 5 out of 15 test cases.
It was an online round conducted on the Chime platform. There were two interviewers, but only one interviewer asked the questions.



For example, consider the following binary tree:

For the above tree, width of level 1 is 1, width of level 2 is 2, width of level 3 is 3 and width of level 4 is 1. So the maximum width of the tree is 3.
I solved this problem by performing a level-order traversal of the tree and using indexing to track each node’s position. The idea was to treat the tree as a complete binary tree, where the root is at index 0, and for any node at index i, its left and right children are at indices 2i + 1 and 2i + 2, respectively.
During the level-order traversal, I kept track of both the node and its index in the queue. For each level, I recorded the indices of the first and last nodes and calculated the width as (last − first + 1). To avoid integer overflow due to large indices at deeper levels, I normalized the indices at each level by subtracting the smallest index of that level from all indices in that level.
Although I solved the problem correctly, it took me a considerable amount of time to implement. The interviewer was initially happy with my approach, but it took me around 40 minutes to write the code correctly while handling all edge cases.



It is possible for Mr. X to rob the same amount of money by looting two different sets of houses. Just print the maximum possible robbed amount, irrespective of sets of houses robbed.
(i) Given the input array arr[] = {2, 3, 2} the output will be 3 because Mr X cannot rob house 1 (money = 2) and then rob house 3 (money = 2), because they are adjacent houses. So, he’ll rob only house 2 (money = 3)
(ii) Given the input array arr[] = {1, 2, 3, 1} the output will be 4 because Mr X rob house 1 (money = 1) and then rob house 3 (money = 3).
(iii) Given the input array arr[] = {0} the output will be 0 because Mr. X has got nothing to rob.
Christmas gifts were arranged in a circle, which means the first and last gifts are adjacent, so the robber cannot pick both of them together.
To handle this circular constraint, I broke the problem into two simpler linear cases. In the first case, I considered robbing from the second gift to the last one (ignoring the first gift). In the second case, I considered robbing from the first gift to the second-to-last one (ignoring the last gift). This way, I avoided the conflict between the first and last gifts. I then took the maximum result from these two cases.
To solve each of these linear cases, I used a dynamic programming approach with space optimization. Instead of using a DP array, I kept track of only two variables: one representing the maximum loot up to the previous position, and another for the position before that. For each gift, I decided whether to pick it (adding its value to the result from two steps back) or skip it (carrying forward the previous result). I took the maximum of these two choices and updated the variables accordingly.
Although I was able to write the solution correctly, the interviewer was not able to understand my code, and I could not explain it clearly. This may have been the reason I got rejected.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which data structure is used to implement a DFS?