You are on page 1of 7

Questions for interviews

Arrays (can use other concepts too)

Related to sum

https://leetcode.com/problems/two-sum
● https://leetcode.com/problems/3sum
● https://leetcode.com/problems/3sum-closest

Related to subarray sums

● https://leetcode.com/problems/subarray-sum-equals-k
● https://leetcode.com/problems/sum-of-subarray-minimums
● https://leetcode.com/problems/minimum-size-subarray-sum/
● https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays

Interval related

● https://leetcode.com/problems/merge-interval
● https://leetcode.com/problems/add-bold-tag-in-string/

Random array questions

● https://leetcode.com/problems/container-with-most-water
● https://leetcode.com/problems/find-the-duplicate-number
● https://leetcode.com/problems/find-all-duplicates-in-an-array
● https://leetcode.com/problems/rotate-array
● https://leetcode.com/problems/spiral-matrix
● https://leetcode.com/problems/set-matrix-zeroes
● https://leetcode.com/problems/sort-the-matrix-diagonally
● https://leetcode.com/problems/majority-element-ii
● https://leetcode.com/problems/split-array-with-equal-sum

Binary search related

● https://leetcode.com/problems/search-in-rotated-sorted-array
● https://leetcode.com/problems/powx-n
● https://leetcode.com/problems/find-peak-element
● https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
● https://leetcode.com/problems/search-a-2d-matrix
● https://leetcode.com/problems/koko-eating-bananas
● https://leetcode.com/problems/find-minimum-in-rotated-sorted-array
● https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold
● https://leetcode.com/problems/capacity-to-ship-packages-within-d-days
● https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero
● https://leetcode.com/problems/shortest-subarray-to-be-removed-to-make-array-sorted
● https://leetcode.com/problems/divide-chocolate

Stacks
● https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses
● https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii
● https://leetcode.com/problems/decode-string
● https://leetcode.com/problems/remove-k-digits
● https://leetcode.com/problems/remove-duplicate-letters
● https://leetcode.com/problems/score-of-parentheses
● https://leetcode.com/problems/reverse-substrings-between-each-pair-of-parentheses
● https://leetcode.com/problems/asteroid-collision
● https://leetcode.com/problems/trapping-rain-water (must do)
● https://leetcode.com/problems/largest-rectangle-in-histogram (must do)

Priority queue (heap)


● https://leetcode.com/problems/k-closest-points-to-origin
● https://leetcode.com/problems/top-k-frequent-words
● https://leetcode.com/problems/top-k-frequent-elements
● https://leetcode.com/problems/find-k-pairs-with-smallest-sums
● https://leetcode.com/problems/find-median-from-data-stream
● https://leetcode.com/problems/reorganize-string
● https://leetcode.com/problems/meeting-rooms-ii/
● https://leetcode.com/problems/employee-free-time/ (hard can skip)

Sorting
● https://leetcode.com/problems/sort-colors
● https://leetcode.com/problems/pancake-sorting
● https://leetcode.com/problems/largest-number
● https://leetcode.com/problems/wiggle-sort
● https://leetcode.com/problems/rank-teams-by-votes
● https://leetcode.com/problems/count-of-smaller-numbers-after-self
● https://leetcode.com/problems/reverse-pairs
● https://leetcode.com/problems/wiggle-sort-ii
● https://leetcode.com/problems/max-chunks-to-make-sorted
● https://leetcode.com/problems/max-chunks-to-make-sorted-ii

Sliding window
● https://leetcode.com/problems/longest-substring-without-repeating-characters
● https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
● https://leetcode.com/problems/sliding-window-maximum
● https://leetcode.com/problems/minimum-window-substring
● https://leetcode.com/problems/longest-repeating-character-replacement
● https://leetcode.com/problems/max-consecutive-ones-iii
● https://leetcode.com/problems/find-k-length-substrings-with-no-repeated-characters
● https://leetcode.com/problems/subarray-product-less-than-k

Greedy

● https://leetcode.com/problems/minimum-deletion-cost-to-avoid-repeating-letters
● https://leetcode.com/problems/partition-labels
● https://leetcode.com/problems/minimum-deletions-to-make-character-frequencies-
unique
● https://leetcode.com/problems/candy
● https://leetcode.com/problems/longest-happy-string
● https://leetcode.com/problems/minimum-swaps-to-make-strings-equal
● https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
● https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers
● https://leetcode.com/problems/monotone-increasing-digits
● https://leetcode.com/problems/frequency-of-the-most-frequent-element
● https://leetcode.com/problems/advantage-shuffle
● https://leetcode.com/problems/minimum-operations-to-make-the-array-increasing
● https://leetcode.com/problems/minimize-maximum-pair-sum-in-array
● https://leetcode.com/problems/equal-sum-arrays-with-minimum-number-of-operations

Dynamic programming

● https://leetcode.com/problems/longest-palindromic-substring
● https://leetcode.com/problems/longest-palindromic-subsequence

● https://leetcode.com/problems/decode-ways
● https://leetcode.com/problems/maximum-subarray
● https://leetcode.com/problems/word-break
● https://leetcode.com/problems/maximum-profit-in-job-scheduling
● https://leetcode.com/problems/maximal-square
● https://leetcode.com/problems/delete-and-earn
● https://leetcode.com/problems/coin-change
● https://leetcode.com/problems/wildcard-matching
● https://leetcode.com/problems/maximum-product-subarray
● https://leetcode.com/problems/maximum-length-of-repeated-subarray
● https://leetcode.com/problems/house-robber
● https://leetcode.com/problems/integer-break
● https://leetcode.com/problems/russian-doll-envelopes
● https://leetcode.com/problems/minimum-path-sum
● https://leetcode.com/problems/longest-string-chain
● https://leetcode.com/problems/minimum-window-subsequence
● https://leetcode.com/problems/matrix-block-sum
● https://leetcode.com/problems/longest-arithmetic-subsequence
● https://leetcode.com/problems/palindrome-partitioning
● https://leetcode.com/problems/longest-common-subsequence
● https://leetcode.com/problems/ones-and-zeroes
● https://leetcode.com/problems/triangle
● https://leetcode.com/problems/house-robber-iii
● https://leetcode.com/problems/wiggle-subsequence
● https://leetcode.com/problems/dungeon-game
● https://leetcode.com/problems/largest-1-bordered-square
● https://leetcode.com/problems/range-sum-query-2d-immutable
● https://leetcode.com/problems/maximum-subarray-sum-with-one-deletion
● https://leetcode.com/problems/remove-boxes
● https://leetcode.com/problems/minimum-falling-path-sum
● https://leetcode.com/problems/edit-distance
● https://leetcode.com/problems/frog-jump
● https://leetcode.com/problems/unique-paths
● https://leetcode.com/problems/knight-dialer
● https://leetcode.com/problems/super-egg-drop

Trees

https://leetcode.com/problems/count-good-nodes-in-binary-tree
https://leetcode.com/problems/serialize-and-deserialize-binary-tree
https://leetcode.com/problems/binary-tree-maximum-path-sum
https://leetcode.com/problems/binary-tree-right-side-view
https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree
https://leetcode.com/problems/validate-binary-search-tree
https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
https://leetcode.com/problems/find-duplicate-subtrees
https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
https://leetcode.com/problems/populating-next-right-pointers-in-each-node
https://leetcode.com/problems/construct-binary-tree-from-string
https://leetcode.com/problems/sum-root-to-leaf-numbers
https://leetcode.com/problems/flatten-binary-tree-to-linked-list
https://leetcode.com/problems/path-sum-ii
https://leetcode.com/problems/closest-leaf-in-a-binary-tree
https://leetcode.com/problems/binary-tree-pruning
https://leetcode.com/problems/path-sum-iii
https://leetcode.com/problems/most-frequent-subtree-sum
https://leetcode.com/problems/maximum-binary-tree
https://leetcode.com/problems/linked-list-in-binary-tree
https://leetcode.com/problems/binary-tree-maximum-path-sum
https://leetcode.com/problems/binary-tree-right-side-view
https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
https://leetcode.com/problems/binary-tree-cameras

Graphs
Bfs and dfs
https://leetcode.com/problems/number-of-islands
https://leetcode.com/problems/max-area-of-island
https://leetcode.com/problems/word-ladder
https://leetcode.com/problems/rotting-oranges
https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph
https://leetcode.com/problems/shortest-bridge
https://leetcode.com/problems/walls-and-gates
https://leetcode.com/problems/01-matrix
https://leetcode.com/problems/surrounded-regions
https://leetcode.com/problems/check-if-there-is-a-valid-path-in-a-grid
https://leetcode.com/problems/making-a-large-island
https://leetcode.com/problems/number-of-closed-islands

Topological sort

https://leetcode.com/problems/course-schedule-ii
https://leetcode.com/problems/alien-dictionary
https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies
https://leetcode.com/problems/parallel-courses

Union find
https://leetcode.com/problems/accounts-merge
https://leetcode.com/problems/redundant-connection
https://leetcode.com/problems/number-of-islands-ii
https://leetcode.com/problems/similar-string-groups
https://leetcode.com/problems/sentence-similarity-ii

You might also like