Tip 1: Build real-world projects to apply concepts practically.
Tip 2: Revise fundamentals regularly and focus on consistent problem-solving.
Tip 3: Learn to explain your thought process clearly during interviews.
Tip 1: Highlight impactful projects with clear problem statements and outcomes
Tip 2: Be honest about your skills and write only what you can explain confidently


Step 1: I initially considered checking all possible subarrays and verifying uniqueness, but this approach was inefficient for large inputs.
Step 2: I optimized the solution using a sliding window approach.
Step 3: I used a hash set to track elements in the current window and adjusted the window whenever a duplicate appeared.
Step 4: This optimization reduced the solution to linear time complexity, which worked well within the coding round constraints.



1. If ‘k’ is not present in 'arr', then print -1.
2. There are no duplicate elements present in 'arr'.
3. 'arr' can be rotated only in the right direction.
Input: 'arr' = [12, 15, 18, 2, 4] , 'k' = 2
Output: 3
Explanation:
If 'arr' = [12, 15, 18, 2, 4] and 'k' = 2, then the position at which 'k' is present in the array is 3 (0-indexed).
Step 1: I first understood that although the array is rotated, one half of it is always sorted.
Step 2: I applied binary search by calculating the middle element and comparing it with the target.
Step 3: I checked whether the left half or the right half of the array was sorted.
Step 4: Based on which half was sorted, I determined whether the target lay in that range or in the other half.
Step 5: I eliminated the irrelevant half and continued the binary search until the element was found or the search space became empty.



In the below graph, there exists a cycle between vertex 1, 2 and 3.

1. There are no parallel edges between two vertices.
2. There are no self-loops(an edge connecting the vertex to itself) in the graph.
3. The graph can be disconnected.
Input: N = 3 , Edges = [[1, 2], [2, 3], [1, 3]].
Output: Yes
Explanation : There are a total of 3 vertices in the graph. There is an edge between vertex 1 and 2, vertex 2 and 3 and vertex 1 and 3. So, there exists a cycle in the graph.
Step 1: I first determined whether the graph was directed or undirected and chose the appropriate approach.
Step 2: I initially explained a simple DFS traversal to explore the graph.
Step 3: For an undirected graph, I used DFS with parent tracking to detect cycles.
Step 4: For a directed graph, I used DFS with a recursion stack to identify back edges.
Step 5: I analyzed the time and space complexity and verified the solution using sample test cases.



[1, 2, 3, 4] is a strictly increasing array, while [2, 1, 4, 3] is not.
Step 1: I first discussed the brute-force recursive approach of generating all subsequences and explained why it was inefficient.
Step 2: I introduced a dynamic programming solution where dp[i] represents the length of the LIS ending at index i.
Step 3: I used two nested loops to update dp[i] by checking all previous elements smaller than the current one.
Step 4: I took the maximum value from the dp array as the final answer.
Step 5: I explained the time complexity as O(N²) and briefly mentioned the optimized O(N log N) approach.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Providing input/output examples in your prompt is a technique called: