Tip 1 : Practice at least 10-20 questions of DS & Also on each topic from difficulty level easy to hard.
Tip 2 : Prepare well around OOPs concepts and Database concepts.
Tip 3 : If you have 2.5+ year of experience practice around HLD and LLD.
Tip 1 : Please mention the keyword related to the work that you have done. (eg. Git, Maven, JUnit, Java, AWS )
Tip 2 : Please mention any certification that you have done. And try to keep your resume within one page.
Overall the first round was for 1h. At start interviewer introduced himself and asked for my introduction. After that he directly jumped to coding question. Interviewer was friendly and he gave me suggestion whenever I got stuck somewhere.



You can assume that the value of ‘K’ will always be less than or equal to ‘N’. So, the answer will always exist.
The general approach/algorithm of sliding door is:
Use two pointers to represent your window. "start" & "end"
Keep moving the end pointer until your condition is true or in other words; the window is valid.
Start to condense your window by moving your start pointer while also simultaneously making sure your window is still valid.
public int minSubArrayLen(int target, int[] nums) {
// basic constraint checking
if (nums == null || nums.length == 0)
return 0;
// initialization of the start & end index of your sliding window
int start = 0, end = 0, sum = 0, minLength = Integer.MAX_VALUE;
while (end < nums.length) {
// keep a running sum as the end pointer expands your window
sum += nums[end++];
// this while loop will be skipped until your window meets the condition that
// the running sum is equal or greater than the int 's' passed in. aka the window
// is valid
while (sum >= target) {
// now you want to condense your window to find the minimum window as the
// problem wants
// updates the min length
minLength = Math.min(minLength, end - start);
// this moves your start index by one condensing your window and
// decreasing the sum to make sure that it's still valid
sum -= nums[start++];
}
}
// if no min is found, return 0 or else return the min length you found above.
return minLength == Integer.MAX_VALUE ? 0 : minLength;
}
This was the second round which was scheduled on in day time. It was based on DS Algo problems.
Interview environment was positive. Interviewer made me comfortable by asking normal question about me and the work that I have done.Overall the interview experience was really great.



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.
public ListNode deleteDuplicates(ListNode head) {
ListNode curr = head;
if(head == null) return null;
// if the head.next == null it means that the list contains only one node (head)
//so there is no duplicates we will simply return the head of the list
if(head.next == null) return head;
else{
while(curr.next != null){
//we compare the data of the current node with the next node if they are equal
//we remove the next node
if(curr.val == curr.next.val)
curr.next = curr.next.next;
else
//if they are not equal we simply move forward
curr=curr.next;
}
}
return head;
}
This round was scheduled in day time. It was based on Low level system design.
Interview environment was positive. Interviewer made me comfortable by asking normal question about me and the work that I have done.Overall the interview experience was really great.



1. get(key) - Return the value of the key if the key exists in the cache, otherwise return -1.
2. put(key, value), Insert the value in the cache if the key 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 recently used item before inserting the new item.
Type 0: for get(key) operation.
Type 1: for put(key, value) operation.
1. The cache is initialized with a capacity (the maximum number of unique keys it can hold at a time).
2. Access to an item or key is defined as a get or a put operation on the key. The least recently used key is the one with the oldest access time.
Solution : Use doubly linked list with HashMap to get O(1) time compleixty for get and put method.
class LRUCache {
Map nodeMap;
DoublyLinkedList doublyLinkedList;
int capacity;
public LRUCache(int capacity) {
nodeMap = new HashMap();
doublyLinkedList = new DoublyLinkedList();
this.capacity = capacity;
}
public int get(int key) {
if(nodeMap.containsKey(key)){
Node node = nodeMap.get(key);
doublyLinkedList.removeGiven(node);
doublyLinkedList.addFirst(node);
return node.val;
}
return -1;
}
public void put(int key, int value) {
if(nodeMap.containsKey(key)){
Node node = nodeMap.get(key);
node.val = value;
doublyLinkedList.removeGiven(node);
doublyLinkedList.addFirst(node);
}else{
if(nodeMap.size() == capacity){
Node node = doublyLinkedList.getTail();
doublyLinkedList.removeLast();
nodeMap.remove(node.key);
}
Node node = new Node(key, value);
doublyLinkedList.addFirst(node);
nodeMap.put(key, node);
}
}
}
class DoublyLinkedList{
private Node head;
private Node tail;
public DoublyLinkedList(){
head = null;
tail = null;
}
public Node getHead(){
return head;
}
public Node getTail(){
return tail;
}
public void addFirst(Node node){
node.prev = null;
node.next = null;
if(head == null ){
head = node;
tail = node;
}else{
node.next = head;
head.prev = node;
head = node;
}
}
public void removeLast(){
if(tail == null ) return;
if(tail.prev == null ) {
tail = null;
head = null;
return;
}
tail.prev.next = null;
tail = tail.prev;
}
public void removeGiven(Node node){
if(node.prev == null ){
head = node.next;
if(node.next == null) tail = null;
else node.next.prev = null;
}else{
node.prev.next = node.next;
if(node.next == null) tail = node.prev;
else node.next.prev = node.prev;
}
}
}
class Node{
int val;
int key;
Node prev;
Node next;
public Node(int key, int val){
this.key = key;
this.val =val;
this.prev = null;
this.next = null;
}
}
This round was scheduled in day time. This was engineering manager round. He asked me the questions related to the work that I have done in my projects. He also asked one coding question as well. Overall the interview experience was great.



If ‘N’ = 5 and ‘Party’ = { {1, 1}, {2, 2}, {1, 3}, {4, 4}, {3, 3}, }
You can attend a maximum of 4 different parties, you can attend the 1’st party on the 1’st day, 2’nd party on the 2’nd day, 3’rd party on the 3’rd day and 4’th party on the 4’th day. But it is impossible to attend the 5’th (last) party, as if we were to attend this party then we would have to attend it instead of the 3’rd party (3’rd day), there may be many other combinations possible, but no combination will result in a maximum number of different parties attend greater than four.
public int maxEvents(int[][] events) {
Comparator comparator = (a, b)-> a[0]-b[0];
Arrays.sort(events, comparator);
PriorityQueue pq = new PriorityQueue();
int i = 0;
int count = 0;
int day = 0'
while(i < events.length || !pq.isEmpty()){
if(pq.isEmpty()) day = events[i][0];
// add all the concurrent event to the queue
while( i< events.length && day == events[i][0]){
pq.add(events[i][1]);
i++;
}
// process the event which is ending early
pq.poll();
count++; // one possible result
//remove events which been ended till current day
while( !pq.isEmpty() && day >= pq.peek()){
pq.poll();
}
//go to next day
day++;
}
return count;
}

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?