Tip 1: Cover as many problems properly in DSA (Data Structures and Algorithms) as possible.
Tip 2: Always ask relevant questions to the interviewer before starting to attempt the problem.
Tip 3: Always cover the points written in your resume properly
Tip 1: Include some projects or previous experience on your resume.
Tip 2: Ensure thorough preparation of everything written on your resume.
You can attempt the test at any time of your comfort. But once it starts you have to finish it in the allocated time.



Given a list of tasks with deadlines and total profit earned on completing a task, find the maximum profit earned by executing the tasks within the specified deadlines. Assume that each task takes one unit of time to complete, and a task can’t be executed beyond its deadline. Also, only a single task will be executed at a time.
We can easily solve this problem by following a Greedy approach. The idea is simple – consider each task decreasing order of their profits and schedule it in the latest possible free slot that meets its deadline. If no such slot is there, don’t schedule the task.
It was a face-to-face interview with a senior software engineer. The interviewer was very friendly and explained the problem properly.



Given a rod of length n and a list of rod prices of length i, where 1 <= i <= n, find the optimal way to cut the rod into smaller rods to maximize profit.
For example, consider the following rod lengths and values:
Input: length[] = [1, 2, 3, 4, 5, 6, 7, 8]price[] = [1, 5, 8, 9, 10, 17, 17, 20]
Rod length: 4
Answer: Cut the rod into two pieces of length 2 each to gain revenue of 5 + 5 = 10
It can be solved using dynamic programming.
We will solve this problem in a bottom-up manner. In the bottom-up approach, we solve smaller subproblems first, then solve larger subproblems from them. The following bottom-up approach computes T[i], which stores the maximum profit achieved from the rod of length i for each 1 <= i <= n. It uses the value of smaller values I already computed.
It was the final round of interviews. He asked me about 2 coding problems, followed by questions about expectations and my availability to start. The interviewer seemed disinterested throughout the interview. Most of the time, he was not looking at me or my screen.



Given a linked list, write a function to reverse every k node (where k is an input to the function).
Example:
Input: 1->2->3->4->5->6->7->8->NULL, K = 3
Output: 3->2->1->6->5->4->8->7->NULL
Input: 1->2->3->4->5->6->7->8->NULL, K = 5
Output: 5->4->3->2->1->8->7->6->NULL
The following steps are required for this Algorithm:
1. Create a dummy node and point it to the head of input i.e. dummy->next = head.
2. Calculate the length of the linked list which takes O(N) time, where N is the length of the linked list.
3. Initialize three-pointers prev, curr, next to reverse k elements for every group.
4. Iterate over the linked lists till next!=NULL.
5. Points curr to the prev->next and next to the curr next.
6. Then, Using the inner for loop reverse the particular group using these four steps:
curr->next = next->next
next->next = prev->next
prev->next = next
next = curr->next
7. This for loop runs for k-1 times for all groups except the last remaining element, for the last remaining element it runs
for the remaining length of the linked list – 1.
8. Decrement count after for loop by k count -= k, to determine the length of the remaining linked list.



What is an LRU cache? Write the implementation of get and put in the LRU cache.
As the name suggests when the cache memory is full, LRU picks the data that is least recently used and removes it to make space for the new data. The priority of the data in the cache changes according to the need of that data i.e. if some data is fetched or updated recently then the priority of that data would be changed and assigned to the highest priority, and the priority of the data decreases if it remains unused operations after operations.
LRUCache (Capacity c): Initialize LRU cache with positive size capacity c.
get (key): Returns the value of Key ‘k’ if it is present in the cache otherwise it returns -1. Also updates the priority of data in the LRU cache.
put (key, value): Update the value of the key if that key exists, Otherwise, add a key-value pair to the cache. If the number of keys exceeds the capacity of the LRU cache then dismiss the least recently used key.

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