0% found this document useful (0 votes)
99 views12 pages

HashedIn by Deloitte

The document provides a comprehensive list of LeetCode questions categorized by topics such as Arrays, Strings, Linked Lists, and more, along with tips for clearing coding rounds. It includes specific problem statements, examples, and sample inputs/outputs for various coding challenges. Additionally, it offers insights into the types of questions that may be encountered in interviews, emphasizing the importance of mastering data structures and algorithms.

Uploaded by

fatic60802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views12 pages

HashedIn by Deloitte

The document provides a comprehensive list of LeetCode questions categorized by topics such as Arrays, Strings, Linked Lists, and more, along with tips for clearing coding rounds. It includes specific problem statements, examples, and sample inputs/outputs for various coding challenges. Additionally, it offers insights into the types of questions that may be encountered in interviews, emphasizing the importance of mastering data structures and algorithms.

Uploaded by

fatic60802
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

DSA (2 medium and 1 hard leetcode)

All LeetCode Questions Categorized by Topic

1. Arrays
• Two Sum - #1
• Best Time to Buy and Sell Stock - #121
• Contains Duplicate - #217
• Product of Array Except Self - #238
• Maximum Subarray - #53
• Find the Duplicate Number - #287
• Merge Intervals - #56
• Insert Interval - #57
• Subarray Sum Equals K - #560
• Sort Colors - #75
• Rotate Array - #189
• Sliding Window Maximum - #239
• Koko Eating Bananas - #875

2. Strings
• Reverse String - #344
• Valid Anagram - #242
• Longest Common Prefix - #14
• Valid Parentheses - #20
• Group Anagrams - #49
• Greatest Common Divisor of Strings - #1071
• Edit Distance - #72
• Robot Return to Origin - #657
• Race Car - #818

3. Linked List
• Merge Two Sorted Lists - #21
• Reverse Linked List - #206
• Linked List Cycle - #141
• Add Two Numbers - #2
• Remove Nth Node From End of List - #19
• Copy List with Random Pointer - #138

4. Stacks & Queues


• Min Stack - #155
• Implement Queue using Stacks - #232
• Daily Temperatures - #739

5. Dynamic Programming (DP)


• Climbing Stairs - #70
• House Robber - #198
• Coin Change - #322
• Longest Increasing Subsequence - #300
• Word Break - #139
• Partition Equal Subset Sum - #416

6. Graphs & Backtracking


• Number of Islands - #200
• Clone Graph - #133
• Course Schedule - #207
• Word Search - #79
• Combination Sum - #39
• Letter Combinations of a Phone Number - #17
• Sudoku Solver - #37

7. Binary Search & Greedy


• Find Minimum in Rotated Sorted Array - #153
• Find Peak Element - #162
• Koko Eating Bananas - #875
• Jump Game - #55
• Jump Game II - #45

8. Trees & Binary Trees


• Maximum Depth of Binary Tree - #104
• Same Tree - #100
• Invert Binary Tree - #226
• Binary Tree Level Order Traversal - #102
• Balanced Binary Tree - #110
• Lowest Common Ancestor of a Binary Search Tree - #235

9. Matrix
• Set Matrix Zeroes - #73
• Rotate Image - #48
• Spiral Matrix - #54
• Search a 2D Matrix - #74

10. Heap & Priority Queue


• Kth Largest Element in an Array - #215
• Top K Frequent Elements - #347
• Merge K Sorted Lists - #23

Tips to Clear Coding Rounds:

Master Data Structures & Algorithms - Arrays, HashMaps, Graphs,


Recursion, DP
Focus on Time & Space Complexity - Optimize brute-force solutions
Practice Pattern-Based Problems - Sliding Window, Two Pointers,
Greedy
Improve Debugging & Edge Cases Handling
Mock Interviews - Practice under time constraints

Let me know if you need a study plan!


1. practice all arrays and string questions
2. 1. string based question. 2.sort the array which contain either 0 or 1 3. It
was dp based question little bit difficult and it was based on subarray
concept
3. Rotate the array k times and return the same array in O(n) time.
4. given two sorted linked list you have to find the median of sorted merge
linked list which does not contain any duplicate element. If it has odd
number of nodes in merged linked list then return middle one and if it
contain even number of nodes then return avg of middle nodes.
5. Three dsa (array,dp)
6. There was a car on 0,0 on a matrix and string s contains the instructions as
r-right,l-left,u-up,d-down ex: rrudl like this we need to find whether after all
operations does the car stand on the same 0,0 or not
7. Longest subarray with sum 0
8. Your car moves on a number line with 'A' (accelerate) doubling speed and
moving forward, while 'R' (reverse) flips the direction. The goal is to find the
shortest sequence of these commands to reach a given target position.(dp)
9. Greedy problem, String based question, and a Math trick question which is
based on GCD of 2 numbers.
10.strings linked lists and some higher dsa
11.koko eating bananas maximum subarray sum
12.length of a tree, merge 2 sorted list
13. 1.On strings (Med) 2.2D Array[easy] 3.Graph Based Question with
Backtracking
14.Write Code for linkedlist (cycle detaction)
15.Rotate Binary search tree
16.Max sum of 2 elements is equal to sum of all elements in the array.
17.was a Sliding Window
18.was also a Sliding Window
19.nwas directly Longest Increasing Subsequence
20.If given two strings if you can convert one string into another with only one
operation of either insertion, deletion, or substitution return true else false
21.Given an Integer array bring all the even integers to front and odd integers
to back without creating a new array in the same insertion order.
22.If give an Integer array and a k value reverse the first k elements and print
the whole array
23.Given a nxn matrix rotate it 90 degrees anticlockwise Managerial
24.Write a C# program for reversing of the Whole String.
25.Write a C# program to print index of Array from given Array Of Numbers [2,
7, 11, 15] whose Sum is 9.
26.There were questions on graphs,trees,arrays
27.Rainwater storing approach.coding question Equilibrium point in array
28.Code for Factorial, Fibonacci series, Armstrong number, asked basic sorting
techniques
29.Return true/false if a^2 + b^2=C is possible, where we will be given C as
input (if C=5, return true, 1*1 + 2*2 = 5).
30.Jump game 1 from leetcode, given an array of int check if we can
reach/cross last index.
31.Program to find out whether the given string is a snowball string or not
32.dsa question find middle of linklist find total unique subarray of 2 number
whose sum is equal to given number convert string 'AAABBFFFRS' TO
A3B2F3R1S1
33.Matrix questions
34.Find the least possible value in string.
35.1)Repeated element in an arrray? 2) Check whether Linked list has loop or
not? 3) one SQL question
36.Longest Palindromic Substring Maximum width of a tree(Not a binary tree)
37.More focused on dsa and especially on graphs and trees that is more
focused on problem solving. And also do solve questions related to dynamic
programming and graph based questions
38.It comprised three questions two of which were easy to medium and the
third was hard. The topics were greedy algorithms, scheduling problems in
queues, and string compression
39. the question about the minimum number of platforms required for a
railway station
40.Maximum number by concatenating every element in a rotation of an Array
of Strings
41.Finding the 2nd Most Frequent String in an Array
42.Sorting in Binary Search Tree
43.Minimum number of platforms required for a railway
44.Deletion in a circular linked list
45.The questions were on topic like array, string, tree and stack
46.Write a program for anagram?and about strings
47.theaf stealing in alternating house
48.Find starting position in rotated sorted array
49. 1.Frequency of a Number 2.Arrange Numbers in ascending order
50.Arrange Squares of sorted array in ascending order, Linked List loop
detection and removal and last question was a min heap question)
51. 1) Left view of the tree. 2) Kadane's algo. 3) Two-sum problem.
52.Print all distinct characters of a string in order
53. from a string, count the occurrences of each letter. - find starting and
ending index of number 2 in an integer array.
54.const arr = [1,2,2,2,2,3,4,5,6]; find starting and ending index of 2 const str =
seedddffffggggggg; count highest occurance;
55.Find missing number in the array? And A string based question
56.Find islands using hashmaps,
57.To check whether a string is of balanced parentheses
58.Reverse a string, Find loop in a linked list, Find next greater element in a
array.
59.is a linked list a palindrom? stack, queue, matrix operations, priority queue
60.Write a program for tic tac toe
61.Implement stack using two queues.
62.Stream of data, Find kth largest element(Using heap) Reverse a linked list up
to 5 elements
63.Write a program to find the maximum LCM of consicutive elements of an
array.
64.quick sort, detect a cycle in linked list, reverse 1st k element of queue,
65.Sum of numbers in the string which is alphanumeric
66.code to reverse a linked list
67.Was asked to code to print longest mountain subarray from a given array
68.Sort an array of 0s, 1s and 2s, Subarray with given sum, Sliding Window
Maximum (Maximum of all subarrays of size k).
69.he given sum in a one dimensional array. b. find largest distinctive string in
the given string.
70.Depth of binary tree. Find the second largest element in array Rearrange
array in odd even manner in O(1) space.
71.Find Maximum length peak in an array.
72.Snake and ladder game logic in dynamic programming
73.Find index in integer array till there the sum is equal from both side.
74. Find biggest row in a 2d array of 1s & 0s, where 1 can't come before 0.
75.Given two unsorted array, merge sort them.
76.Design the snake and ladder game, find the minimum number of moves
required to finish the games.
77.Count the number of islands in a 2d grid.
78.Implement a stack which keeps pops the max element in constant time.
79. Given S="babaa", the function should return 3. There are four blocks: "b", "a", "b",
"aa". One letter each should be added to the first, second and third blocks,
therefore obtaining a string "bbaabbaa", in which every block is of equal length.
80. Given S="bbbab", the function should return 4. Two letters each should be added
to the second and third blocks, therefore obtaining a string "bbbaaabbb", in
which every block is of equal length.
81. Given S="bbbaaabbb", the function should return 0. All blocks are already of
equal lengths.

Problem Statement: Rahul copies in the exam from his adjacent students.
But he doesn’t want to be caught, so he changes words keeping the letter
constant. That means he interchanges the positions of letters in words. You
are the examiner and you have to find if he has copied a certain word from
the one adjacent student who is giving the same exam, and give Rahul the
markings he deserves.
Note that: Uppercase and lowercase are the same.
Input Format:
• First line with the adjacent student’s word
• Second line with Rahul’s word
Output Format:
• 0 if not copied
• 1 if copied
• Constraints:
• 1<=Length of string<=10^6
Sample Input:
• CAR
• Acr
Sample Output:
• 1

Problem Statement: You are given an array, You have to choose a


contiguous subarray of length ‘k’, and find the minimum of that segment,
return the maximum of those minimums.
Sample input :
• 1 → Length of segment x =1
• 5 → size of space n = 5
• 1 → space = [ 1,2,3,1,2]
• 2
• 3
• 1
• 2
Sample output :
• 3
Explanation :
• The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray
only contains 1 element, each value is minimal with respect to the subarray
it is in. The maximum of these values is 3. Therefore, the answer is 3

Anirudh is attending an astronomy lecture. His professor who is very strict


asks students to
Write a program to print the trapezium pattern using stars and dots as
shown below . Since Anirudh is not good at astronomy can you help him?
Sample Input:
• N=3
Output:
**.**
*…*
…..
*…*
**.**

QUESTION 04: Formatting large Products


Problem Statement: Rohan is weak in mathematics.He is giving
mathematics Olympiad , but he got stuck in one of the question .Help
rohan to solve the question.In Question there are two positive integer A
and B. You have to find the product of all integer between A and B which is
represented in the form C=D*10^E , where C is the product of numbers , D
and E are non-negative integers and the last digit of D is non-zero.
Function Description
• Complete the function formatProducts in the editor below, formatProduct
must return a string that represents C in the above described form.
• Function has the following parameters
• A: an integer
• B: an integer
Constraints
• A will between 1 and 1,000,000 . Inclusive.
• B will be between A and 1,000,000. Inclusive.
Sample Input 0
• 1
• 5
Sample Output 0
• 12 * 10^1
Explanation
• 1*2*3*4*5=120 = 12 * 10^1
Sample Input 1
• 3
• 10
Sample Output 1
• 18144 * 10^2
Explanation
• 3*4*….*10=1814400 =18144 * 10^2

Question 05: Password Creation


Problem Statement: A password manager wants to create new passwords
using two strings given by the user, then combined to create a harder-to-
guess combination. Given two strings,interleave the characters of the
strings to create a new string. Beginning with an empty string, alternately
append a character from string a and from string b. If one of the strings is
exhausted before the other, append the remaining letters from the other
string all at once. The result is the new password.
Example :
• If a = ‘hackerrank’ and b = ‘mountain’,
• The result is hmaocuknetrariannk.
Function Description :
• Complete the function newPassword in the editor below.
Parameter(s):
• Str : string a
• Str : string b
• Returns:
• Str: new password using two strings
Sample input:
• abc → a=”abc”
• def → b=”def”
Sample output 0:
• Adbecf

1. Given a string s and integer k. We have to return the string having <= k
characters of the string s from the beginning.
2. Example: s="Codility We test coder" and k=14
Output: "Codility We"
3. Given Two Arrays, return the number of occurrences of the fraction that
appears most.
4. Example: a={1,2,3,4} , b={2,3,6,8}
Output => 3 as (1/2=3/6=4/8}
5. Basically in this question we were given a function of O(n^2) complexity and
our task was to make it O(n).

1. Level Easy: It was similar to this


question: https://www.geeksforgeeks.org/equilibrium-index-of-an-array/
2. Level Medium: https://leetcode.com/discuss/interview-
question/1725338/codility-oa-deloitte-hashedin
3. Level Hard: It was a variant of this
question: https://app.codility.com/programmers/lessons/4-
counting_elements/frog_river_one/

1. first, array sorting related question. (Easy)


2. Second, maximum adjacent Pair sum type (Medium)
3. Third, 2-D array similar to N-Queen (Medium)

Interview
1. your resume in detail, database architecture design, your fav framework
in detail) HR round Basic hr discussion
2. Design the database architecture of library management system
3. DB design and query Fitment and HR round
4. questions from SQL, basic of JAVA and some higher DSA questions
5. Discuss and design a split-wise app.
6. SQL command to retrieve 3rd highest salary
7. system design and dsa
8. How will you design instagram based upon system design.

You might also like