Questions

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

https://leetcode.

com/discuss/interview-question/672135/Dunzo-Online-Assessment-Hackerrank

https://www.geeksforgeeks.org/top-25-interview-questions/
Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[].

Singleton Design pattern. How you make it double ton(in even call of getInstance() first object should be
return and odd call of getInstance() second instance should be return). Make it triple ton.

why strings are immutable ?


how many objects will be created in
String temp = "A" + "B" + "C" ; Only two objects will be created. "A", "B", "C" are string constants, they will
be put into constant pool in .class file at compile time, not in the heap. One object is created for
intermediate result "A" + "B", another one is temp.

Different types of joins


Normal forms with examples.

179. Largest Number


string largestNumber(const vector<int>& v) {
int n = v.size();
string ans = "";
vector<string>s;
for (int i = 0; i < n; i++)
{
s.push_back(to_string(v[i]));
}
sort(begin(s), end(s), [](string &s1, string &s2){ return s1+s2>s2+s1; });
for (int i = 0; i < n; i++)
{
ans += s[i];
}
int p = 0;
while (ans[p] == '0' && p + 1 < ans.size()) p++;
return ans.substr(p);
}

Given a binary tree print the boundary view.


Find the median from a stream of integers.(Use 2 heaps one MinHeap and one MaxHeap)
Why GS.
design an end-to-end system for a grocery store
Be prepared for behavioral questions.

DP problems,BST
Given two sorted arrays, find the median of them.

given tree is binary search tree


In a linked list, find nth element from the end
System design question to design alert processing system
Implement cache where each element in cache have its own expiry time.
1. Difference between Thread and Process
2. Mvn:install and mvn:package difference
3. Why use Jenkins
4. MongoDB- if its in your resume - find an employee document in a collection
5. thread creation Java
6. Different types of joins and examples
7. Gave a sample code in online editor and asked to check if the given number is pow of 10. edge cases,
boundary values for testing
8. Virtual in java
9. SQL to query first 3 rows from DB.
10. Unix Grep and is grep case sensitive?
11. unix get first 10 lines or last 10 lines of file

Find the min depth in a binary tree.

segment tree then about the lazy propagation(I said yes). Then he asked the following question

Ques 3: Normal segment tree with update operation on [l, r] and some constant value x s.t add add x to
a[l], x+1 to a[l+1], ……., x+r-l to a[r]. Normal range query i.e calculate the sum in [l, r].

0/1 Knapsack problem.


https://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/
https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-using-priority_queue-stl/
https://www.geeksforgeeks.org/search-in-row-wise-and-column-wise-sorted-matrix/
https://www.geeksforgeeks.org/josephus-problem-set-1-a-on-solution/

Immutable classes in Java. Started with basic details on how to make any class immutable.
Question 1: House Robber Question link: https://leetcode.com/problems/house-robber/
Question 2: Print boundary Traversal of a Treelink: Boundary Traversal of binary tree

Left View of a Binary Tree (Most optimal solution required O(n) time and O(1) space)link: Print Left View
of a Binary Tree

Height of a Tree
Some question on Tree which can be solved using PostOrder Traversal
Merge Sort vs Quick Sort (which is to be used with Arrays/LinkedLists)
Quick Sort (Discussion on Pivot) – Randomized Quick Sort (Only basic discussion on this)
Find the running median
Internal working of HashSet
Write a code for building a heap and explain its time complexity
ArrayList vs LinkedList (In terms of usage)
Hashtable vs HashMap vs ConcurrentHashMap
50 challenging problems in probability
Explain JAVA memory model.
 Design Messenger System.
3. Stateful vs Stateless.
4. What is Caching?
5. How redis store data? Why you use it in your project.
6. Rest v/s Soap
https://www.geeksforgeeks.org/puzzle-round-table-coin-game/

https://www.geeksforgeeks.org/tag/goldman-sachs/page/4/

https://www.geeksforgeeks.org/must-do-coding-questions-for-companies-like-amazon-microsoft-adobe/

https://www.geeksforgeeks.org/geeksforgeeks-special-21-prepare-for-top-tech-companies/?ref=leftbar-rightbar

https://www.geeksforgeeks.org/load-factor-and-rehashing/

Median of two sorted arrays


Find the minimum element in a sorted and rotated array
Add 1 to a number represented as linked list

Delete a node in BST


3.Intersection point of two linked list.

4.Check if a linked list is palindrome or not

Generate all possible substrings from given string


Balance brackets in an expression
Mirror Image of Tree, OLA System Design
Describe the CI/CD pipeline
Design a real-time fleet management system
1. remove duplicate in linked list (write code)
2. first non repeating char in string (code)
3.discussion about hashmap and internal implementation
4. discussion about hashcode() and equal method in java.
5. questions on java collections
In managerial round asked some questions about database and asked me to design Walmart database
(system design)
Design a Calendar app APIs to create an event, cancel it and update it.
Book rooms for the events.

ZigZag Traversal of binary tree


Stock span problem
Lock & key problem
N meetings in 1 room
Bottom view of tree

Design questions
Lift system

Java based question


Garbage collection
Print even and odd using thread
Hashmap internals
Java concurrency problem

what are reference type in java? I said anything other than primitive types in java are objects and we can
say reference, he then said weak reference ,i said weak,soft and strong references ,I had forgotten their
difference

dependency management .I said what you have written is IoC ,DI is different from Ioc .

How concurrent HashMap works? I explained .I did say it is still not safe to use in multi threaded
environment ,use atomic methods like putIfAbsent . May be he was not aware of it.

java program to reverse a string using recursive function


2. What will happen to execution of programme if return statement present in the try block..will it execute
finally block?
3. Implement arraylist using array

1. Find Kth element in the Linkedlist from the end


2. Find the sum of two elements in the array which is closest to zero

Sort a Map using its values.


Give the 2'nd maximum number from an unsorted array of numbers.
Design an event capture library.
Design a log collection and alerting system.
Java multi threading and GC in detail, Clustering and fallback mechanisms

Number of islands in binary matrix


Repeated Factorial calculation optimisation
Parking lot design

How will you convert a heap into a doubly linked list?


How will you recursively reverse a linked list?
Derive the relation between number of nodes and height of a tree.
Delete the last k nodes of a linked list. How will you optimize it?

Quick Sort Algorithm and its time complexity in best case & worst case
1 Answer
Linked List copy with random nodes
Sort an array of zeros and ones
Delete a specific node
Delete a random node without root

1. Producer consumer problem and solution


2. Getting most trending hashtag from a stream of tweets efficiently
4. ConcurrentHashMap in java and how does it work and difference b/w other hashmaps.
2. Calculate the minimum dice rolls you need to win a snake-ladder game denoted by a 2 dimensional
matrix where position of snakes and ladder are also given.

How do you connect to database using JDBC ,write full code


Maven lifecycle

8. Given a linked list, find the mid-node. I gave a solution, I was asked to give a second approach as well.
9. Given a string, swap the nth index with (l-n-1)th index , where l is the length of the string. Have to write
working code.

What is the difference between checked and unchecked exception .Draw the exception hierarchy.
Problem on finding a palindrome on Linked List.
https://www.geeksforgeeks.org/given-a-binary-tree-print-all-root-to-leaf-paths/
find the minimum platform needed to accommodate all trains in station
Mirror of tree
rotate a array of length L by k ,in o(n)
show the code for executor service with fixed thread pool and callable thread

Desing a booking system (basically propose a design with all possible tables in the database)
int findMin(int a[])
// array is sorted in increasing order, but is rotated some spaces i.e. {6, 1, 2, 3, 4, 5} or {4, 5, 6, 1, 2, 3}
// must be completed in O(log n) time .

boolean isPowerOfTen(int x) // Need to handle case where x > INTEGER.MAX_VALUE or < MIN_VALUE  

What is DNL
What is cache
Convert 10 based number to 7 based  

String compression and one about calculating the maximum average of students' scores in a 2D array.

Design an elevator  

looking to test your understanding of how to manipulate data. String manipulation and matrix operations
were focused upon.

looking to test your understanding of how to manipulate data. String manipulation and matrix operations
were focused upon.

Round 1: Nothing much an introduction of yourself and a leetcode problem.


                    Occurrences of substring in a string.
Round 2: leetcode
                    Sort array of strings by size.
Round 3: Tell me the must challenging project you work on and leetcode of two string, one is rotate, return
true if rotate.

Round 4: Tell me the most challenging project you work on again. Have you have any nontechnical
problem , how do you came about it.

Round 5: DS question.
median of two sorted array, hash map implementation, 2nd smallest in a array
- Create Hashmap
- Multi-threading questions - hard (easy if taken Masters level OS course in college)
- Java Garbage collection questions
- Array/String manipulation - Leetcode basic/medium difficulty
- Distributed systems design questions  
2D Array, best average calculator using HashMap
Basic data structure questions, like graph, linked list related questions.  
Implement BST  
[8:20 PM, 5/19/2020] Vibs: Implement a run length encoding function. For a string input the function returns
output encoded as follows:

"a" -> "a1"


"aa" -> "a2"
"aabbb" -> "a2b3"
"aabbbaa" -> "a2b3a2"
"" -> ""
[8:21 PM, 5/19/2020] Vibs: Group Anagrams

1) Given a list of words, group them by anagrams


Input: List of "cat", "dog", "god"
Output: A Set of Sets of anagrams: {{'cat'}, {'dog', 'god'}}
2) Run this code in the REPL to observe its behaviour. The execution entry point is main().
3) Consider adding some additional tests in doTestsPass().
4) Implement the AnagramSolution group() method correctly.
5) If time permits, try to improve your implementation.
[8:22 PM, 5/19/2020] Vibs: You have 8 coins, one of which is lighter than the rest, and a scale one which you
can weigh two things against each other.
You can use the scale 3 times, determine which coin is lighter than the rest.
[8:23 PM, 5/19/2020] Vibs: write a program to print the digits of the avagadro number. This question was
asked to a summer intern

You might also like