Tip 1: Focus on common problem patterns, such as dynamic programming or binary search.
Tip 2: Split complex problems into smaller parts.
Tip 3: Practice under time constraints to build speed.
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.



1. If the value is present in the array, return its index.
2. If the value is absent, determine the index where it would be inserted in the array while maintaining the sorted order.
3. The given array has distinct integers.
4. The given array may be empty.
Input: arr = [1, 2, 4, 7], m = 6
Output: 3
Explanation: If the given array 'arr' is: [1, 2, 4, 7] and m = 6. We insert m = 6 in the array and get 'arr' as: [1, 2, 4, 6, 7]. The position of 6 is 3 (according to 0-based indexing)
Step 1: I first recognized that since the array was already sorted, a binary search approach would be the most efficient way to find the target or determine its position.
Step 2: I initialized two pointers, low and high, to the start and end of the array, respectively.
Step 3: I iterated using a loop until low was greater than high. I calculated the middle index (mid) and checked if the element at mid was equal to the target.
Step 4: If the target was equal to arr[mid], I returned mid as the index. If the target was smaller, I moved the high pointer to mid - 1. Otherwise, I moved the low pointer to mid + 1.
Step 5: If the target was not found, I returned the low value as the correct insert position.



If two rows have the same number of 1’s, return the row with a lower index.
If no row exists where at-least one '1' is present, return -1.
Input: ‘N’ = 3, 'M' = 3
'ARR' =
[ [ 1, 1, 1 ],
[ 0, 0, 1 ],
[ 0, 0, 0 ] ]
Output: 0
Explanation: The 0th row of the given matrix has the maximum number of ones.
Step 1: Understand how to access elements in a 2D array. In a 2D array, elements are accessed using two indices: one for rows and one for columns. For example, arr[i][j] gives you the element in the i-th row and j-th column.
Step 2: Initialize an empty result array to store the maximum values from each row.
Step 3: Use a loop to iterate through each row of the 2D array. This loop will run from 0 to the number of rows (n).
Step 4: For each row, initialize a variable max_val with the first element of the row to start tracking the maximum.
Step 5: Use a nested loop to iterate over all the columns in the current row. Compare each element with max_val and update max_val if a larger element is found.
Step 6: After processing a row, append the max_val to the result array.
Step 7: Repeat the process for all rows and return the result array containing the maximum values from each row.



1. INSERT(key, value): Inserts an integer value to the data structure against a string type key if not already present. If already present, it updates the value of the key with the new one. This function will not return anything.
2. DELETE(key): Removes the key from the data structure if present. It doesn't return anything.
3. SEARCH(key): It searches for the key in the data structure. In case it is present, return true. Otherwise, return false.
4. GET(key): It returns the integer value stored against the given key. If the key is not present, return -1.
5. GET_SIZE(): It returns an integer value denoting the size of the data structure.
6. IS_EMPTY(): It returns a boolean value, denoting whether the data structure is empty or not.
1. Key is always a string value.
2. Value can never be -1.
First(Denoted by integer value 1): Insertion to the Data Structure. It is done in a pair of (key, value).
Second(Denoted by integer value 2): Deletion of a key from the Data Structure.
Third(Denoted by integer value 3): Search a given key in the Data Structure.
Fourth(Denoted by integer value 4): Retrieve the value for a given key from the Data Structure.
Fifth(Denoted by integer value 5): Retrieve the size of the Data Structure.
Sixth(Denoted by integer value 6): Retrieve whether the Data Structure is empty or not.
Step 1: Initialize two vectors — one for keys and one for values. Each element in the keys vector will correspond to the element at the same index in the values vector.
Step 2: Create an empty HashMap (or unordered_map in C++) that will store key-value pairs from the two vectors.
Step 3: Iterate through the vectors using a loop. Use the index i to access corresponding elements in both the keys and values vectors.
Step 4: For each iteration, insert the key and corresponding value into the HashMap.
Step 5: After completing the loop, the HashMap will contain all key-value pairs from the vectors.
Explain a Linked List. (Learn)
Tip 1: Know your data structures thoroughly.
Tip 2: Practice questions based on them.

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