Tip 1: Solve one medium to hard question per topic on coding platforms.
Tip 2: Focus on core topics like arrays, strings, sliding windows, OOP, trees, and linked lists.
Tip 3: Practice solving problems regularly to improve speed and confidence.
Tip 1: Be sure to know your projects thoroughly and be honest about them.
Tip 2: Include relevant projects that effectively showcase your skills and experience.


Write a program to count the number of occurrence of a given substring within a provided string.
Step 1: I first checked if the substring exists in the main string using find() method of the C++ string class. This method returns the position of the first occurrence of the substring or string::npos if the substring is not found.
Step 2: Once I confirmed that the substring was present, I wrote a loop to repeatedly use find() to locate the substring and count its occurrences. Each time a match was found, I moved the search position forward by 1 to avoid counting the same match multiple times.
Step 3: The interviewer was happy with this approach as it was simple and efficient. It allowed for counting the occurrences without manually iterating over the string and using extra data structures.

Given a 2-dimensional array of integers, write a function to find the maximum element in each row of the array. The function should return an array of maximum values from each row.
Tip 1: Understand how to access elements in a 2D array. Use two indices: one for the row and one for the column. For example, arr[i][j] gives you the element in the i-th row and j-th column.
Tip 2: Loop through the array row by row (outer loop) and column by column (inner loop). This helps you process each element individually when you need to perform operations like summing or finding the maximum.
Tip 3: When summing elements in a row or column, try to do it in a single loop (i.e., iterate through each element only once). This will help optimize performance.
What is a binary tree? Explain its functionality. (Learn)
Tip 1: Know your data structures thoroughly.
Tip 2: Practise questions based on them.



You are given an array of integers 'ARR' of length 'N' and an integer Target. Your task is to return all pairs of elements such that they add up to Target.
Step 1: I initially used two loops, i.e., a nested loop, to solve the problem, which resulted in a time complexity of O(n²).
Step 2: The interviewer asked me to optimize the solution. I then tried optimizing it by replacing the two loops with an if-else statement, but this still didn’t result in the required O(n) solution.
Step 3: I wasn’t able to think of any other method at the time, which made the interviewer feel somewhat disappointed.

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