Tip 1: Practice as many questions as you can.
Tip 2: Complete at least two projects covering both frontend and backend.
Tip 1: Don't lie on your resume. You should have complete practical knowledge of everything mentioned in it.
Tip 2: Use bullet points for each key detail.



Step 1: Thought of naive simulation approach — too slow (O(n²)).
Step 2: Realized similar to odd-even jump problem; need next_higher and next_lower.
Step 3: Precompute next_higher and next_lower using sorting + monotonic stack (O(n log n)).
Step 4: Use DP to determine which indices can reach end.
Step 5: Count all starting indices where we can reach the end on odd jumps.
Step 6: Optimized solution impressed the interviewer.

Let 'emails' = ["test.email+alex@ninjas.com", "test.e.mail+bob.case@ninjas.com", "testemail@ninjas.com"].
We need to find the number of unique email addresses after applying the rules.
The first email "test.email+alex@ninjas.com":
The local name is "test.email+alex" and the domain name is "ninjas.com".
Applying the rules to the local name:
Remove '.' -> "testemail+alex"
Ignore everything after '+' -> "testemail"
The processed email address is "testemail@ninjas.com".
The second email "test.e.mail+bob.case@ninjas.com":
The local name is "test.e.mail+bob.case" and the domain name is "ninjas.com".
Applying the rules to the local name:
Remove '.' -> "testemail+bob.case"
Ignore everything after '+' -> "testemail"
The processed email address is "testemail@ninjas.com".
The third email "testemail@ninjas.com":
The local name is "testemail" and the domain name is "ninjas.com".
No '.' or '+' in the local name.
The processed email address is "testemail@ninjas.com".
The unique processed email addresses are {"testemail@ninjas.com"}.
Therefore, the number of different addresses that actually receive mails is 1.
Step 1: Split the email into local and domain parts using '@'.
Step 2: In local part, remove everything after '+' and all '.' characters.
Step 3: Combine cleaned local and domain parts back together.
Step 4: Store each normalized email in a set to ensure uniqueness.
Step 5: Return the number of unique emails (size of set).



For given 2D array :
[ [ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ] ]
After 90 degree rotation in anti clockwise direction, it will become:
[ [ 3, 6, 9 ],
[ 2, 5, 8 ],
[ 1, 4, 7 ] ]
Step 1: Transpose the matrix (convert rows to columns).
Step 2: Reverse each column to achieve anti-clockwise rotation.
Step 3: Done in-place without using extra space.



A book will be allocated to exactly one ninja.
At least one book has to be allocated to a ninja.
Allotment of the books should be done in a contiguous manner. For example, a ninja can not be allocated book 2 and book 4, skipping book 3.
Step 1: Possible maximum pages per ninja range from max(book pages) to sum(all pages).
Step 2: Use binary search to find minimum feasible maximum.
Step 3: For each mid, simulate allocation — if possible with B ninjas, try smaller max.
Step 4: Finally, low will give minimum of the maximum pages.

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