100% found this document useful (1 vote)
1K views

60 Days DSA Challenge

The document provides a 60-day preparation guide for MAANG interviews by Tutort. It lists 22 days of coding questions from easy to medium difficulty that are commonly asked during interviews at companies like Microsoft, Amazon, Apple, Netflix and Google. Each day focuses on a different coding problem and provides the problem statement, its difficulty level, and the companies that typically ask the question. It also includes placement statistics and success stories from past Tutort students who secured jobs at top tech companies.

Uploaded by

pk
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
100% found this document useful (1 vote)
1K views

60 Days DSA Challenge

The document provides a 60-day preparation guide for MAANG interviews by Tutort. It lists 22 days of coding questions from easy to medium difficulty that are commonly asked during interviews at companies like Microsoft, Amazon, Apple, Netflix and Google. Each day focuses on a different coding problem and provides the problem statement, its difficulty level, and the companies that typically ask the question. It also includes placement statistics and success stories from past Tutort students who secured jobs at top tech companies.

Uploaded by

pk
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/ 33

www.tutort.

net +91 87123 38901

60 Days
DSA Challenge
by

A Preparation Guide for MAANG Interviews

Can’t believe I made it into Google


Day 1

Two Sum Easy

Given an array of integers nums and an integer target , return indices

of the two numbers such that they add up to target

You may assume that each input would have exactly one solution, and

you may not use the same element twice.

You can return the answer in any order.

Practice Question asked in:

Valid Parentheses Easy

Given a string s containing just the characters '(' , ')' , '{' , '}' ,

'[' & ']' , determine if the input string is valid.

An input string is valid if:

Open brackets must be closed by the same type of brackets.

Open brackets must be closed in the correct order.

Every close bracket has a corresponding open bracket of the same type.

Practice Question asked in:

Placement Stats 127% Avg Hike


Day 2

Merge Two Sorted Lists Easy

You are given the heads of two sorted linked lists list1 and list2 .

Merge the two lists in a one sorted list. The list should be made by splicing

together the nodes of the first two lists.

Return the head of the merged linked list.

Practice Question asked in:

Best Time to Buy and Sell Stock Easy

You are given an array prices where prices[i] is the price of a given

stock on the ith day.

You want to maximize your profit by choosing a single day to buy one

stock and choosing a different day in the future to sell that stock.

Return the maximum profit you can achieve from this transaction.

If you cannot achieve any profit, return 0

Practice Question asked in:

From To

Basant Prata p Singh


Software Engineer at Google
Day 3
Valid Palindrome Easy

A phrase is a palindrome if, after converting all uppercase letters into

lowercase letters and removing all non-alphanumeric characters, it

reads the same forward and backward. Alphanumeric characters

include letters and numbers.

Given a string s return true if it is a palindrome, or false otherwise.

Practice Question asked in:

Day 4
Invert Binary Tree Easy

Given the root of a binary tree, invert the tree, and return its root

Practice Question asked in:

Tutort Provides 24x7 Live 1:1 Video based doubt support


Day 5
Valid Anagram Easy
Given two strings s and t , return true if t is an anagram of s , and
false otherwise.
An Anagram is a word or phrase formed by rearranging the letters of a

different word or phrase, typically using all the original letters exactly once.
Practice Question asked in:

Day 6
Binary Search Easy
Given an array of integers nums which is sorted in ascending order, and
an integer target , write a function to search target in nums . If target
exists, then return its index. Otherwise, return -1 .
You must write an algorithm with 0(log n) runtime complexity.

Practice Question asked in:

Placement Stats 23 Lakh Avg CTC


D ay 7
Flood Fill Easy

An image is represented by an m x n integer grid image where image[i][j]

represents the pixel value of the image.

You are also given three integers sr , sc and color . You should perform

a flood fill on the image starting from the pixel image[sr][sc] .

Return the modified image after performing the flood fill.

Practice Question asked in:

D ay 8
Lowest Common Ancestor of a Binary

Search Tree Easy

Given a binary search tree (BST), find the lowest common ancestor (LCA)

node of two given nodes in the BST.

According to the definition of LCA on Wikipedia: “The lowest common

ancestor is defined between two nodes p and q as the lowest node in T

that has both p and q as descendants (where we allow a node to be a

descendant of itself ).”

Practice Question asked in:


Day 9

Balanced Binary Tree Easy

Given a binary tree, determine if it is height-balanced.

Practice Question asked in:

Day 10

Linked List Cycle Easy

Given head , the head of a linked list, determine if the linked list has
a cycle in it.

There is a cycle in a linked list if there is some node in the list that can be
reached again by continuously following the next pointer . Internally, pos
is used to denote the index of the node that tail's next pointer is connected
to. Note that pos is not passed as a parameter.

Return true if there is a cycle in the linked list. Otherwise, return false .

Practice Question asked in:

Tutort Provides Special support for foreign students


Day 11
First Bad Version Easy

Suppose you have n versions [1, 2, ..., n] and you want to find out
the first bad one, which causes all the following ones to be bad.

You are given an API bool isBadVersion(version) which returns whether


version is bad. Implement a function to find the first bad version.

Practice Question asked in:

Day 12
Ransom Note Easy

Given two strings ransomNote and magazine , return true if ransomNote


can be constructed by using the letters from magazine and false otherwise.

Each letter in magazine can only be used once in ransomNote

Practice Question asked in:

From To
Gerald Amalraj
Fullstack Developer at JPMorgan Chase
Day 13

Climbing Stairs Easy

You are climbing a staircase. It takes n steps to reach the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways

can you climb to the top?

Practice Question asked in:

Day 14

Longest Palindrome Easy

Given a string s which consists of lowercase or uppercase letters,

return the length of the longest palindrome that can be built with

those letters.

Letters are case sensitive, for example, "Aa" is not considered a

palindrome here.

Practice Question asked in:


Day 15

Add Binary Easy

Given two binary strings a and b return their sum as a binary string. s

Practice Question asked in:

Day 16

Diameter of Binary Tree Easy

Given the root of a binary tree, return the length of the diameter of the tree.

The diameter of a binary tree is the length of the longest path between
any two nodes in a tree. This path may or may not pass through the root

Practice Question asked in:

From To
Akansha Likhdhari
Software Engineer III at Walmart
Day 17

Middle of the Linked List Easy

Given the head of a singly linked list, return the middle node of the linked list.

If there are two middle nodes, return the second middle node.

Practice Question asked in:

Day 18

Maximum Depth of Binary Tree Easy

Given the root of a binary tree, return its maximum depth.

A binary tree's maximum depth is the number of nodes along the

longest path from the root node down to the farthest leaf node.

Practice Question asked in:

Placement Stats 95 Lakh Highest CTC


Day 19

K Closest Points to Origin Medium

Given an array of points , where points[i] = [xi, yi]

represents a point on the X-Y plane and an integer k , return the k

closest points to the origin (0, 0)

You may return the answer in any order. ,

Practice Question asked in:

Day 20

Longest Substring Without Repeating


Characters Medium

Given a string s find the length of the longest substring without

repeating characters.

Practice Question asked in:


Day 21
3Sum Medium
Given an integer array nums, return all the triplets
[nums[i], nums[j], nums[k]] such that i != j , i != k and j != k ,
and nums[i] + nums[j] + nums[k] == 0
Notice that the solution set must not contain duplicate triplets.
Practice Question asked in:

Day 22
Binary Tree Level Order Traversal Medium
Given the root of a binary tree, return the level order traversal
of its nodes' values. (i.e., from left to right, level by level).
Practice Question asked in:

From To
Anjali Joshi
Data Engineer - L2 at Twilio
Day 23
Clone Graph Medium

Given a reference of a node in a connected undirected graph. ,

Return a deep copy (clone) of the graph.

Practice Question asked in:

Day 24
Evaluate Reverse Polish Notation Medium

You are given an array of strings tokens that represents an arithmetic


expression in a Reverse Polish Notation.
Evaluate the expression. Return an integer that represents the value

of the expression.

Practice Question asked in:

Tutort Provides 1:1 Mentorship from Industry experts


Day 25
Course Schedule Medium

There are a total of numCourses courses you have to take, labeled from
0 to numCourses - 1 . You are given an array prerequisites where
prerequisites[i] = [ai, bi] indicates that you must take course
b i first if you want to take course a i .

Return true if you can finish all courses. Otherwise, return false .

Practice Question asked in:

Day 26
Implement Trie (Prefix Tree) Medium

Implement the Trie class:


Trie() Initializes the trie object.
void insert(String word) Inserts the string word into the trie.
boolean search(String word) Returns true if the string word is in the trie
boolean startsWith(String prefix) Returns true if there is a previously
inserted string word that has the prefix.

Practice Question asked in:


Day 27
Coin Change Medium

You are given an integer array coins representing coins of different


denominations and an integer amount representing a total amount of money.

Return the fewest number of coins that you need to make up that amount.
If that amount of money cannot be made up by any combination
of the coins, return -1

Practice Question asked in:

Day 28
Product of Array Except Self Medium

Given an integer array nums return an array answer such that answer[i]
is equal to the product of all the elements of nums except nums[i]

You must write an algorithm that runs in O(n) time and without using
the division operation.

Practice Question asked in:

Tutort Provides 24x7 Live 1:1 Video based doubt support


Day 29
Min Stack Medium

Design a stack that supports push, pop, top, and retrieving the minimum

element in constant time.

Implement the MinStack class:


MinStack() initializes the stack object.
void push(int val) pushes the element val onto the stack.
void pop() removes the element on the top of the stack.
int top() gets the top element of the stack.
int getMin() retrieves the minimum element in the stack.

You must implement a solution with O(1) time complexity for each function.:

Practice Question asked in:

Day 30

Validate Binary Search Tree Medium

Given the root of a binary tree, determine if it is a valid binary


search tree (BST).

Practice Question asked in:


Day 31
Number of Islands Medium

Given an m x n 2D binary grid grid which represents a map of '1' s


(land) and '0' s (water), return the number of islands.

An island is surrounded by water and is formed by connecting adjacent

lands horizontally or vertically. You may assume all four edges of the grid

are all surrounded by water.

Practice Question asked in:

Day 32
Rotting Oranges Medium

You are given an m x n grid where each cell can have one of
three values:

0 representing an empty cell,


1 representing a fresh orange, or
2 representing a rotten orange.

Return the minimum number of minutes that must elapse until no cell
has a fresh orange. If this is impossible, return -1

Practice Question asked in:


Day 33
Search in Rotated Sorted Array Medium

There is an integer array nums sorted in ascending order (with distinct values).

Given the array nums after the possible rotation and an integer target
return the index of target if it is in nums , or -1 is not in nums

You must write an algorithm with O(log n) runtime complexity.

Practice Question asked in:

Day 34
Combination Sum Medium

Given an array of distinct integers candidates and a target integer candidates


target return a list of all unique combinations of candidates where
the chosen numbers sum to target You may return the combinations
in any order.

Practice Question asked in:


Day 35

Permutations Medium

Given an array nums of distinct integers, return all the possible permutations.
You can return the answer in any order.

Practice Question asked in:

Day 36

Merge Intervals Medium

Given an array of intervals where intervals[i] = [starti, endi]


merge all overlapping intervals, and return an array of the
non-overlapping intervals that cover all the intervals in the input.

Practice Question asked in:

From To
Subhadip Chowdhury
SWE at Target
Day 37

Lowest Common Ancestor of a


Binary Tree Medium

Given a binary tree, find the lowest common ancestor (LCA) of two given

nodes in the tree.

Practice Question asked in:

Day 38

Time Based Key-Value Store Medium

Implement the TimeMap class:

TimeMap() Initializes the trie object.

void set(String key, String value, int timestamp)

String get(String key, int timestamp)

Practice Question asked in:

Placement Stats 23 Lakh Avg CTC


Day 39
Accounts Merge Medium

Given a list of accounts where each element accounts[i] is a list of strings

where the first element accounts[i][0] is a name, and the rest of the

elements are emails representing emails of the account.

After merging the accounts, return the accounts in the following format:

the first element of each account is the name, and the rest of the elements

are emails in sorted order. The accounts themselves can be returned

in any order.

Practice Question asked in:

Day 40
Sort Colors Medium

Given an array nums with n objects colored red, white, or blue, sort them

in-place so that objects of the same color are adjacent, with the colors
in the order red, white, and blue.

You must solve this problem without using the library's sort function.

Practice Question asked in:

Tutort Provides Special support for foreign students


Day 41
String to Integer (atoi) Medium

Implement the myAtoi(string s) function, which converts a string


string to a 32-bit signed integer (similar to C/C++'s atoi function).

Return the integer as the final result.

Practice Question asked in:

Day 42
Spiral Matrix Medium

Given an m x n matrix return all elements of the matrix in


spiral order.

Practice Question asked in:

From To
Savita Ranganathan
Senior Software Engineer at Freshworks
Day 43

Subsets Medium

Given an integer array nums of unique elements, return all possible

subsets (the power set).

The solution set must not contain duplicate subsets. Return the

solution in any order.

Practice Question asked in:

Day 44

Binary Tree Right Side View Medium

Given the root of a binary tree, imagine yourself standing on

the right side of it, return the values of the nodes you can see
ordered from top to bottom.

Practice Question asked in:

Placement Stats 23 Lakh Avg CTC


Day 45
Longest Palindromic Substring Medium

Given a string s return the longest Palindromic Substring in s

Practice Question asked in:

Day 46

Unique Paths Medium

There is a robot on an m x n grid. The robot is initially located at the


top-left corner. The robot tries to move to the bottom-right corner
The robot can only move either down or right at any point in time.

Given the two integers m and n , return the number of possible unique
paths that the robot can take to reach the bottom-right corner.

Practice Question asked in:

Tutort Provides Special support for foreign students


Day 47
Construct Binary Tree from Preorder
and Inorder Traversal Medium
Given two integer arrays preorder and inorder where preorder
is the preorder traversal of a binary tree and inorder is the inorder
traversal of the same tree, construct and return the binary tree.

Practice Question asked in:

Day 48
Container With Most Water Medium

You are given an integer array height of length n . There are n


vertical lines drawn such that the two endpoints of the i line th

are (i, 0) and (i, height[i])

Return the maximum amount of water a container can store.

Practice Question asked in:

From To
Akansha Likhdhari
Software Engineer III at Walmart
Day 49

Find All Anagrams in a String Medium

Given two strings s and p , return an array of all the start indices of

p ‘s anagrams in s . You may return the answer in any order.

Practice Question asked in:

Day 50

Minimum Height Trees Medium

Given a tree of n nodes labelled from 0 to n-1 and an array of

n-1 edges where edges[i] = [ai, bi] indicates that there is

an undirected edge between the two nodes in the tree, you can
choose any node of the tree as the root.

Return a list of all MHTs' root labels. You can return the answer in any order.

Practice Question asked in:

From To
Saumya Mishra
Sr. AEM Consultant at Adobe
Day 51

Task Scheduler Medium

Given a characters array tasks , representing the tasks a CPU

needs to do, where each letter represents a different task. Tasks could
be done in any order. Each task is done in one unit of time.

Return the least number of units of times that the CPU will take to finish

all the given tasks.

Practice Question asked in:

Day 52

LRU Cache Medium

Design a data structure that follows the constraints of a

Least Recently Used (LRU) cache.

Implement the LRUCache class:

LRUCache(int capacity) Initialize the LRU cache with positive size capacity

int get(int key) Return the value of the key if the key exists.

void put(int key, int value) Update the value of the key

Practice Question asked in:


Day 53

Kth Smallest Element in a BST Medium

Given the root of a binary search tree, and an integer k , return

th
the k smallest value (1-indexed) of all the values of the nodes in the tree.

Practice Question asked in:

Day 54

Minimum Window Substring Hard

Given two strings s and t of lengths m and n respectively, return

the minimum window substring of s such that every character in

t (including duplicates) is included in the window. If there is no

such substring, return the empty string “”

The testcases will be generated such that the answer is unique.

Practice Question asked in:

From To

Avishkar Dalvi

MTS 3 at VMware
Day 55
Find Median from Data Stream Hard

The median is the middle value in an ordered integer list. If the size

of the list is even, there is no middle value, and the median is the mean

of the two middle values.


For example, for arr = [2,3,4] , the median is 3
For example, for arr = [2,3] , the median is (2 + 3) / 2 = 2.5

Practice Question asked in:

Day 56
Word Ladder Hard

A transformation sequence from word beginWord to word endWord


using a dictionary wordList is a sequence of words
beginWord -> s1 -> s2 -> ... -> sk such that:

Given two words, beginWord and endWord , and a dictionary wordList


, return the number of words in the shortest transformation sequence from
beginWord to endWord , or 0 if no such sequence exists.

Practice Question asked in:


Day 57

Basic Calculator Hard

Given a string s representing a valid expression, implement a basic

calculator to evaluate it, and return the result of the evaluation.

Practice Question asked in:

Day 58

Maximum Profit in Job Scheduling Hard

We have n where every job is scheduled to be done from

startTime[i] to endTime[i] , obtaining a profit of profit[i]

Return the maximum profit you can take such that there are no two

jobs in the subset with overlapping time range.

Practice Question asked in:

From To

Basant Pratap Singh


Software Engineer at Google
Day 59

Merge k Sorted Lists Hard

You are given an array of k linked-lists lists , each linked-list

is sorted in ascending order.

Merge all the linked-lists into one sorted linked-list and return it.

Practice Question asked in:

Day 60

Largest Rectangle in Histogram Hard

Given an array of integers heights representing the histogram's bar

height where the width of each bar is 1 , return the area of the largest

rectangle in the histogram.

Practice Question asked in:

Placement Stats 1000+ Placements


Start your

Upskilling with us
Join our Job-Oriented Programs

Explore more
www.tutort.net
Watch us on YouTube Read more on Quora

Explore our courses


Advanced DSA & System Full Stack Specialisation in
Design Course Software Development

Follow us on
. . . . . .

Phone E-mail Address


+91-8712338901 [email protected] D001, Shilpitha Splendour Annex,

Bengaluru, Karnataka 560048

You might also like