Tip 1: Practice Data Structures and Algorithms consistently and solve problems on coding platforms.
Tip 2: Build at least 2–3 real-world projects using technologies like React and Node.js to gain practical experience.
Tip 3: Revise core CS subjects regularly, such as Operating Systems, DBMS, and OOPs, before interviews.
Tip 1: Include strong projects that clearly demonstrate your skills in technology and problem-solving.
Tip 2: Keep your resume concise (one page) and highlight measurable achievements such as coding ratings, rankings, or the impact of your projects.



Two strings are isomorphic if a one-to-one mapping is possible for every character of the first string ‘str1’ to every character of the second string ‘str2’ while preserving the order of the characters.
All occurrences of every character in the first string ‘str1’ should map to the same character in the second string, ‘str2’.
If str1 = “aab” and str2 = “xxy” then the output will be 1. ‘a’ maps to ‘x’ and ‘b’ maps to ‘y’.
If str1 = “aab” and str2 = “xyz” then the output will be 0. There are two different characters in 'str1', while there are three different characters in 'str2'. So there won't be one to one mapping between 'str1' and 'str2'.
Step 1: I first clarified the concept of isomorphic strings with examples and understood that each character must map uniquely to another character.
Step 2: My initial idea was to track character mappings using a data structure to ensure one-to-one mapping between characters of both strings.
Step 3: I used a mapping approach to store relationships between characters of the two strings while iterating through t hem simultaneously.
Step 4: During traversal, I checked whether an existing mapping was consistent and ensured no two characters mapped to the same character.
Step 5: If all mappings remained consistent throughout the iteration, I concluded that the strings are isomorphic; otherwise, they are not.



‘N’ = 4, ‘K’ = 2
‘ARR’ = [1, 1, 2, 3]
There are ‘3’ subarrays with ‘2’ distinct elements, which are as follows: [1, 2], [2, 3], [1, 1, 2].
Thus, you should return ‘3’ as the answer.
Step 1: I first discussed the brute-force approach of checking all possible subarrays and counting distinct elements, but it would take O(N²) time, which is inefficient.
Step 2: The interviewer hinted at using a sliding window technique to optimize the solution.
Step 3: I used the idea that the number of subarrays with exactly K distinct elements equals the number of subarrays with at most K distinct elements minus those with at most (K−1) distinct elements.
Step 4: I then implemented a sliding window with a hashmap to maintain the frequency of elements within the window and track the number of distinct elements.
Step 5: By calculating the count of subarrays with at most K and at most (K−1) distinct elements, I subtracted the results to get the number of subarrays with exactly K distinct integers.
Find employees who earn more than their managers.
Each employee may have a manager, and the managerId refers to the id of another employee in the same table.
Write an SQL query to find the names of employees whose salary is greater than their manager’s salary. (Practice)
Step 1: I first observed that the manager’s information is also stored in the same table, so this problem requires a self-join.
Step 2: I joined the Employee table with itself, where the employee’s managerId matches the manager’s id.
Step 3: After joining, I compared the employee’s salary with the manager’s salary.
Step 4: I filtered the records where the employee's salary is greater than the manager's salary.
Step 5: Finally, I selected the employee names that satisfy this condition.



'S' = "{}()".
There is always an opening brace before a closing brace i.e. '{' before '}', '(' before ').
So the 'S' is Balanced.
Step 1: I first considered checking the brackets sequentially but realized that simple counting would not work for cases like "([)]".
Step 2: I then proposed using a stack data structure, as stacks naturally follow the Last-In-First-Out (LIFO) principle, which fits this problem.
Step 3: I traversed the string character by character. Whenever I encountered an opening bracket, I pushed it onto the stack.
Step 4: Whenever I encountered a closing bracket, I checked the top element of the stack. If it matched the corresponding opening bracket, I popped it; otherwise, the string was invalid.
Step 5: After completing the traversal, if the stack was empty, the string was valid; otherwise, it was invalid.



Input: 'a' = [2, 4, 6] and 'b' = [1, 3, 5]
Output: 3.5
Explanation: The array after merging 'a' and 'b' will be { 1, 2, 3, 4, 5, 6 }. Here two medians are 3 and 4. So the median will be the average of 3 and 4, which is 3.5.
Step 1: I first discussed the brute-force approach of merging both arrays and then finding the median, but that would take O(m+n) time, which does not satisfy the required complexity.
Step 2: The interviewer asked me to think of a more optimal approach, leveraging the fact that both arrays are already sorted.
Step 3: I proposed using binary search on the smaller array to partition both arrays into left and right halves.
Step 4: I ensured that the largest element on the left side is less than or equal to the smallest element on the right side after partitioning.
Step 5: Once the correct partition was found, I calculated the median based on whether the total number of elements was even or odd.
Step 6: This approach satisfies the required O(log(min(m, n))) time complexity, and the interviewer was satisfied with the optimized solution.

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?