Tip 1 : Practice DSA from the internet etc.
Tip 2 : Go through the subjects from internet etc.
Tip 1 : Keep it one-pager
Tip 2 : Try to cover maximum points by keeping each crisp. No need to go into details.



Input: Linked List: 1 <-> 2 <-> 2 <-> 2 <-> 3
Output: Modified Linked List: 1 <-> 2 <-> 3
Explanation: We will delete the duplicate values ‘2’ present in the linked list.
While traversing the linked list, we need to skip the duplicates and keep only unique ones in the list



Similar to the previous question but here the linked list is an unsorted one. Hashed the nodes while traversing to keep counter of the unique nodes.


1. To implement means you need to complete some predefined functions, which are supported by a normal queue such that it can efficiently handle the given input queries which are defined below.
2. The implemented queue must support the following operations of a normal queue:
a. enQueue(data) : This function should take one argument of type integer and place the integer to the back of the queue.
b. deQueue(): This function should remove an integer from the front of the queue and also return that integer. If the queue is empty, it should return -1.
c. peek(): This function returns the element present in the front of the queue. If the queue is empty, it should return -1.
d. isEmpty(): This function should return true if the queue is empty and false otherwise.
3. You will be given q queries of 4 types:
a. 1 val - For this type of query, you need to insert the integer val to the back of the queue.
b. 2 - For this type of query, you need to remove the element from the front of the queue, and also return it.
c. 3 - For this type of query, you need to return the element present at the front of the queue(No need to remove it from the queue).
d. 4 - For this type of query, you need to return true if the queue is empty and false otherwise.
4. For every query of type:
a. 1, you do not need to return anything.
b. 2, return the integer being deQueued from the queue.
c. 3, return the integer present in the front of the queue.
d. 4, return “true” if the queue is empty, “false” otherwise.
Operations:
1 5
1 10
2
3
4
Enqueue operation 1 5: We insert 5 at the back of the queue.
Queue: [5]
Enqueue operation 1 10: We insert 10 at the back of the queue.
Queue: [5, 10]
Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
Output: 5
Queue: [10]
Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
Output: 10
Queue: [10]
IsEmpty operation 4: We check if the queue is empty.
Output: False
Queue: [10]
Used two stacks for this problem. Either we can achieve push operation in O(1) and pop in O(n) or push operation in O(n) and pop in O(1)



Used Kadane's algorithm in this problem



If we are given an array ARR=[1,2,3] then the power set P(ARR) of the set ARR is: [ [], [1], [2], [1,2], [3], [1,3], [2,3], [1,2,3] ]
For every subset 'X' present in power set P(ARR) of set ARR, X must be sorted i.e. in the example above:
P1(ARR) = [ [], [1], [2], [1,2], [3], [1,3], [2,3], [1,2,3] ]
P2(ARR) = [ [], [1], [1,2,3], [2], [1,2], [3], [1,3], [2,3] ]
P3(ARR) = [ [], [1], [2], [1,2], [3], [1,3], [2,3], [2,3,1] ]
P1(ARR) and P2(ARR) will be considered correct power sets but P3(ARR) will not be considered correct because there the last subset [2, 3, 1] is not sorted.
Used bit manipulation method to print all the subsets of the string



1. The input string may contain the same characters, so there will also be the same permutations.
2. The order of permutation does not matter.
Used backtracking to print all permutations of string



N = 12, M = 3 and STR = ‘CODINGNINJAS’

There are three rows (‘M = 3’) in the zig-zag pattern. Row one contains ‘CNN’, row two contains ‘OIGIJS’, and row three contains ‘DNA’. After concatenating the three rows, we get the string ‘CNNOIGIJSDNA’. So, the answer is ‘CNNOIGIJSDNA’.
1. The string ‘STR’ consists of capital letters only (i.e., characters from ‘A-Z’).
Created string array of size same as the number of rows and then while traversing the string pushed each character into the respective row index



Step one is to find the first decreasing number from the right. Next step is to find a number just larger than this number. Then swap these two numbers. Now we have to reverse the array after the index where we found the first decreasing number.
1. What is semaphore/mutex?
2. Race condition and critical section problem
3. Some questions on Object Oriented Design and Design Patterns

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?