Coders Crushby Napplied AI

Data Structures & Algorithms

100+ curated problems from top tech interviews

AllArrays & HashingTwo PointersSliding WindowStack & QueueBinary SearchLinked ListsTreesTriesHeap / Priority QueueGraphsDynamic ProgrammingBacktrackingGreedyIntervalsMath & GeometryBit Manipulation

32 problems found

Number of Islands

#200
MediumGraphs

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 wa...

Coders Crushby Napplied AI

The ultimate interview preparation platform. Master System Design, DSA, and tackle community challenges to crush your FAANG interviews.

Looking for jobs? Visit Napplied AI Jobs Search Agent

System Design

  • All Problems
  • Easy
  • Hard

DSA

  • All Problems
  • Dynamic Programming
  • Graphs

More

  • Problems Arena
  • Growth Paths
  • My Crush

Coders Crush by Napplied AI - Tech Interview & Coding Should Be Effortless

O(m*n) / O(m*n)
Google, Amazon

LRU Cache

#146
MediumStack & Queue

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class with get and put operations in...

O(1) / O(capacity)
Google, Amazon

Merge Intervals

#56
MediumIntervals

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals...

O(n log n) / O(n)
Google, Amazon

N-Queens

#51
HardBacktracking

The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return al...

O(n!) / O(n²)
Google, Amazon

Permutations

#46
MediumBacktracking

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

O(n! * n) / O(n)
Google, Amazon

Subsets

#78
MediumBacktracking

Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets....

O(n * 2^n) / O(n)
Google, Amazon

Word Ladder

#127
HardGraphs

A transformation sequence from beginWord to endWord using dictionary wordList is a sequence where every adjacent pair of words differs by a single let...

O(M² * N) / O(M * N)
Google, Amazon

Course Schedule

#207
MediumGraphs

There are a total of numCourses courses you have to take. Some courses may have prerequisites. Given the total number of courses and a list of prerequ...

O(V + E) / O(V + E)
Google, Amazon

Invert Binary Tree

#226
EasyTrees

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

O(n) / O(h)
Google, Amazon

Binary Search

#704
EasyBinary Search

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...

O(log n) / O(1)
Google, Amazon

Search in Rotated Sorted Array

#33
MediumBinary Search

There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at a...

O(log n) / O(1)
Google, Amazon

Lowest Common Ancestor of BST

#235
MediumTrees

Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST....

O(h) / O(1)
Google, Amazon

Binary Tree Maximum Path Sum

#124
HardTrees

A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. The path sum of a path i...

O(n) / O(h)
Google, Amazon

Climbing Stairs

#70
EasyDynamic Programming

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 ...

O(n) / O(1)
Google, Amazon

Longest Increasing Subsequence

#300
MediumDynamic Programming

Given an integer array nums, return the length of the longest strictly increasing subsequence....

O(n log n) / O(n)
Google, Amazon

Word Break

#139
MediumDynamic Programming

Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary wor...

O(n² * m) / O(n)
Google, Amazon

Coin Change

#322
MediumDynamic Programming

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return ...

O(amount * n) / O(amount)
Google, Amazon

Edit Distance

#72
MediumDynamic Programming

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations...

O(mn) / O(mn)
Google, Amazon

Valid Palindrome

#125
EasyTwo Pointers

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the ...

O(n) / O(1)
Google, Amazon

Container With Most Water

#11
MediumTwo Pointers

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, hei...

O(n) / O(1)
Google, Amazon

Trapping Rain Water

#42
HardTwo Pointers

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining....

O(n) / O(1)
Google, Amazon

Longest Substring Without Repeating Characters

#3
MediumSliding Window

Given a string s, find the length of the longest substring without repeating characters....

O(n) / O(min(m,n))
Google, Amazon

Minimum Window Substring

#76
HardSliding Window

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 duplicat...

O(m + n) / O(m + n)
Google, Amazon

Sliding Window Maximum

#239
HardSliding Window

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You ca...

O(n) / O(k)
Google, Amazon

3Sum

#15
MediumTwo Pointers

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]...

O(n²) / O(1)
Google, Amazon

Contains Duplicate

#217
EasyArrays & Hashing

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct....

O(n) / O(n)
Google, Amazon

Product of Array Except Self

#238
MediumArrays & Hashing

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 w...

O(n) / O(1)
Google, Amazon

Top K Frequent Elements

#347
MediumArrays & Hashing

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order....

O(n) / O(n)
Google, Amazon

Group Anagrams

#49
MediumArrays & Hashing

Given an array of strings strs, group the anagrams together. You can return the answer in any order....

O(n * k log k) / O(n * k)
Google, Amazon

Valid Anagram

#242
EasyArrays & Hashing

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 ...

O(n) / O(1)
Google, Amazon

Longest Consecutive Sequence

#128
MediumArrays & Hashing

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n...

O(n) / O(n)
Google, Amazon

Two Sum

#1
EasyArrays & Hashing

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 inp...

O(n) / O(n)
Google, Amazon