Tip 1: Be consistent with DSA and focus on problem-solving patterns rather than just solving random questions.
Tip 2: Revise core concepts like Data Structures, OOP, DBMS, and practice explaining your approach clearly.
Tip 3: Build and deeply understand real-world projects so that you can confidently discuss them during interviews.
Tip 1: Include strong projects with clear impact and be ready to explain each of them in detail.
Tip 2: Do not add anything to your resume that you cannot justify or explain during the interview.
Let 'N' = 5, 'X' = [1, 2, 4, 3, 5] and 'A' = [20, 0, 10, 0, 1].
Oggy moves to position 1 and collects 'A[1]' coins at time t = 1. Then, Oggy will move to position 5, which takes 4 seconds. So, at time t = 5, he will collect 1 coin. In total, he will be able to collect 21 coins.
Hence, the answer will be 21.
Step 1: Sort the cockroaches by their distance from 0 (closest first).
Step 2: Sort the bullets in descending order of power.
Step 3: For each bullet:
Step 4: While killing, ensure that no cockroach reaches 0 before being killed.
Step 5: If all cockroaches are killed → return the minimum time.



A connected component in the map is the maximum subset of cities that are connected i.e we can go from one city to any other in that subset.
Store points using a map for fast lookup
Start BFS from (1,1)
From (x, y) → check points within range (x±2, y±2)
Use map to efficiently find neighbors (avoid O(n²))
Mark visited and push into queue
If (n, m) reached → return distance
Else → return -1

Biotonic Doubly linked list is the one which is first increasing and then decreasing. A strictly increasing or strictly decreasing doubly linked list is also biotonic.
Find middle using slow & fast pointers
Split the list into two halves
Recursively sort both halves
Merge two sorted lists
While merging, update next and prev pointers
Return the new head



For ‘N’ = 6 and ‘EDGES’ = [ [0,1], [0, 2], [2, 3], [2, 4], [2, 5] ], see the below picture for reference:

1. For node 0:
a. Distance from node 0 to node 1 is 1.
b. Distance from node 0 to node 2 is 1.
c. Distance from node 0 to node 3 is 2.
d. Distance from node 0 to node 4 is 2.
e. Distance from node 0 to node 5 is 2.
So the sum of all the distances is 8.
2. For node 1:
a. Distance from node 1 to node 0 is 1.
b. Distance from node 1 to node 2 is 2.
c. Distance from node 1 to node 3 is 3.
d. Distance from node 1 to node 4 is 3.
e. Distance from node 1 to node 5 is 3.
So the sum of all the distances is 12.
3. For node 2:
a. Distance from node 2 to node 0 is 1.
b. Distance from node 2 to node 1 is 2.
c. Distance from node 2 to node 3 is 1.
d. Distance from node 2 to node 4 is 1.
e. Distance from node 2 to node 5 is 1.
So the sum of all the distances is 6.
4. For node 3:
a. Distance from node 3 to node 0 is 2.
b. Distance from node 3 to node 1 is 3.
c. Distance from node 3 to node 2 is 1.
d. Distance from node 3 to node 4 is 2.
e. Distance from node 3 to node 5 is 2.
So the sum of all the distances is 6.
5. For node 4:
a. Distance from node 4 to node 0 is 2.
b. Distance from node 4 to node 1 is 3.
c. Distance from node 4 to node 2 is 1.
d. Distance from node 4 to node 3 is 2.
e. Distance from node 4 to node 5 is 2.
So the sum of all the distances is 6.
6. For node 5:
a. Distance from node 5 to node 0 is 2.
b. Distance from node 5 to node 1 is 3.
c. Distance from node 5 to node 2 is 1.
d. Distance from node 5 to node 3 is 2.
e. Distance from node 5 to node 4 is 2.
So the sum of all the distances is 6.
So, ‘ANS’ for the above example will be [8, 12, 6, 10, 10, 10].
* Build a graph with edge indices
* Push all police stations into the queue (multi-source BFS)
* Mark them visited with distance = 0
* Run BFS while `dist < d`
* If visiting an already visited node → mark that edge for removal
* Continue BFS
* Output all removed edge indices



Given a binary tree :

All the root to leaf paths are :
1 2 4
1 2 5
1 3
1. Two nodes may have the same value associated with it.
2. The root node will be fixed and will be provided in the function.
3. Note that the nodes in a path will appear in a fixed order. For example, 1 2 3 is not the same as 2 1 3.
4. Each path should be returned as a string consisting of nodes in order and separated by a space.
5. The path length may be as small as ‘1’.
Build the adjacency list (tree).
Start DFS from node 1.
Maintain a consecutive cat count.
If a node has a cat → increment; otherwise, reset to 0.
If the count exceeds m → stop that path.
If it is a leaf node → count it as a valid restaurant.
Return the total count.
Design a scalable system similar to a flight booking platform like MakeMyTrip, where users can:
Tip 1: Clearly define functional and non-functional requirements before designing the system.
Tip 2: Break the system into scalable components like search, booking, and payment, and use caching and databases efficiently.
Tip 3: Always consider edge cases like concurrent bookings, failures, and scalability while explaining your design.
Find all users who have logged in for at least three consecutive days.
SELECT user_id
FROM (
SELECT
user_id,
login_date,
DATE_SUB(login_date, INTERVAL ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY login_date) DAY) AS grp
FROM logins
) t
GROUP BY user_id, grp
HAVING COUNT(*) >= 3;
Given a table logins:
| user_id | login_date |
Find the longest consecutive login streak for each user.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which traversal uses a queue as its primary data structure?