Tip 1: Focus on improving your problem-solving skills.
Tip 2: Solve a good number of questions on coding platforms.
Tip 1: Do not include false information on your resume.
Tip 2: Include some projects on your resume.

Step 1: I first thought about using Depth-First Search (DFS), but realized it wasn’t suitable here since we need the shortest path, and DFS doesn’t guarantee minimum steps.
Step 2: Then I switched to Breadth-First Search (BFS), as it is ideal for finding the shortest path in an unweighted grid like this one.
Step 3: I implemented BFS starting from the top-left corner (0,0), using a queue to explore each safe cell ('O') in all four directions (up, down, left, right), and tracked visited positions to avoid cycles.
Step 4: For each valid move, I added the new position and step count to the queue. As soon as I found the treasure cell ('X'), I returned the step count as the answer.
Step 5: I tested it with the sample input, and the output was correct. The interviewer was satisfied since it used BFS effectively and was optimized for shortest path discovery.

Step 1: I started by trying to generate all numbers from low to high and manually check if each number had sequential digits. However, this approach was inefficient and slow.
Step 2: I realized that instead of checking every number, I could directly generate only valid sequential digit numbers, which would reduce unnecessary computation.
Step 3: I created a base string, "123456789", and used substrings of different lengths (from 2 to 9) to generate sequential numbers. For example, a length of 3 gives “123,” “234,” “345,” and so on.
Step 4: I converted each valid substring into an integer and added it to the result only if it fell within the given range [low,high][low, high][low,high].
Step 5: After generating all valid numbers, I sorted the final result to maintain increasing order and returned it. The solution was efficient and accepted by the platform.



'EQUATIONS' = { {“a”, ”s”} , {“s”, “r”} }
'VALUES' = { 1.5, 2 }
queries = { {“a”, “r” } }
For the above example (a / s) = 1.5 and (s / r) = 2 therefore (a / r) = 1.5 * 2 = 3.
Step 1: At first, I thought of trying a brute-force approach by checking all equations for each query. But this was inefficient and didn’t scale for larger inputs.
Step 2: Then I realized the problem could be modeled as a graph, where each variable is a node, and the division relationship forms weighted edges between nodes (e.g., a / b = 2.0 means edge from a → b with weight 2.0, and b → a with weight 1/2.0).
Step 3: I built an adjacency list to represent the graph. For each equation, I added both forward and reverse edges.
Step 4: For each query, I performed a DFS traversal starting from the numerator to the denominator, multiplying the weights along the path. If the path existed, I returned the product; if not, I returned -1.0.
Step 5: I handled edge cases like missing nodes or self-division (a/a) separately. Once done, I tested the code with multiple cases, and the solution passed. The interviewer appreciated the graph-based approach.
I was asked Behavioral questions based on Amazon’s Leadership Principles. Some examples included:
These questions assessed how well I aligned with principles like Ownership, Bias for Action, and Deliver Results. I answered them using the STAR format (Situation, Task, Action, Result) to provide structured and clear responses.
Tip 1: Before the interview, I made sure to read and understand the Leadership Principles thoroughly.
Tip 2: Give examples from your own experience.
Tip 3: Relax and stay confident.

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?