Tip 1 : Practice At least 20 questions from each topic like LinkedList, Graphs, Trees, and HashMap and all medium data structures.
Tip 2 : try to complete the medium code in 30 mins of durations.
Tip 3 : Prepare one coding language with which you are more comfortable.
Tip 1 : Have some projects on your resume.
Tip 2 : Never put false things.
this round contains 2 coding problems with 30 basic OS, DBMS, CN mcq questions.



You can use any string of A multiple times.
A =[“coding”, ”ninjas”, “is”, “awesome”] target = “codingninjas”
Ans = true as we use “coding” and “ninjas” to form “codingninjas”
First I tried to use Hashmap for this. Then it did not work. So I used Trie data structure to solve this problem.



class graphNode
{
public:
int data;
vector<graphNode*> neighbours;
}
1. Nodes are numbered from 1 to N.
2. Your solution will run on multiple test cases. If you are using global variables make sure to clear them.
using the hashmap, we can keep track of nodes we have already created.
Which of the following is a command of DDL?
1) Alter
2) Delete
3) Create
4) All of the Above
Tip 1:choose most appropriate ans.
To avoid deadlock ____________
a) there must be a fixed number of resources to allocate
b) resource allocation must be done only once
c) all deadlocked processes must be aborted
d) inversion technique can be used
Tip 1: choose best ans to the question
Which of the following layers is an addition to the OSI model when compared with the TCP IP model?
a) Application layer
b) Presentation layer
c) Session layer
d) Session and Presentation layer
Tip 1: Do not take too much time for a single question.
Interviewer was good.



Operation 1 - insert(word) - To insert a string WORD in the Trie.
Operation 2- search(word) - To check if a string WORD is present in Trie or not.
Operation 3- startsWith(word) - To check if there is a string that has the prefix WORD.

The above figure is the representation of a Trie. New words that are added are inserted as the children of the root node.
Alphabets are added in the top to bottom fashion in parent to children hierarchy. Alphabets that are highlighted with blue circles are the end nodes that mark the ending of a word in the Trie.
Type = ["insert", "search"], Query = ["coding", "coding].
We return ["null", "true"] as coding is present in the trie after 1st operation.
For solving this problem, you must have an understanding of Trie data structures.



Input: 'a' = [1, 5, 3, 4, 2]
Output: NGE = [5, -1, 4, 5, 5]
Explanation: For the given array,
- The next greater element for 1 is 5.
- There is no greater element for 5 on the right side. So we consider NGE as -1.
- The next greater element for 3 is 4.
- The next greater element for 4 is 5, when we consider the next elements as 4 -> 2 -> 1 -> 5.
- The next greater element for 2 is 5, when we consider the next elements as 2 -> 1 -> 5.
this problem can be solved using stack data structures.
Only 1 hard coding question was asked.



1. put(U__ID, value): Insert the value in the cache if the key(‘U__ID’) is not already present or update the value of the given key if the key is already present. When the cache reaches its capacity, it should invalidate the least frequently used item before inserting the new item.
2. get(U__ID): Return the value of the key(‘U__ID’), present in the cache, if it’s present otherwise return -1.
1) The frequency of use of an element is calculated by a number of operations with its ‘U_ID’ performed after it is inserted in the cache.
2) If multiple elements have the least frequency then we remove the element which was least recently used.
Type 1: for put(key, value) operation.
Type 2: for get(key) operation.
We perform the following operations on an empty cache which has capacity 2:
When operation 1 2 3 is performed, the element with 'U_ID' 2 and value 3 is inserted in the cache.
When operation 1 2 1 is performed, the element with 'U_ID' 2’s value is updated to 1.
When operation 2 2 is performed then the value of 'U_ID' 2 is returned i.e. 1.
When operation 2 1 is performed then the value of 'U_ID' 1 is to be returned but it is not present in cache therefore -1 is returned.
When operation 1 1 5 is performed, the element with 'U_ID' 1 and value 5 is inserted in the cache.
When operation 1 6 4 is performed, the cache is full so we need to delete an element. First, we check the number of times each element is used. Element with 'U_ID' 2 is used 3 times (2 times operation of type 1 and 1-time operation of type 1). Element with 'U_ID' 1 is used 1 time (1-time operation of type 1). So element with 'U_ID' 1 is deleted. The element with 'U_ID' 6 and value 4 is inserted in the cache.
this problem can be solved using 2 hashmaps.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
How do you remove whitespace from the start of a string?