0% found this document useful (0 votes)
125 views21 pages

DP Mostly Asked Questions Sorted by Frequency

The document lists the top LeetCode problems sorted by frequency. It shows the problem title, acceptance rate, difficulty, and frequency for each of the top problems. Many of the most frequent problems involve trees, graphs, and dynamic programming. Common tree problems include binary tree traversal, lowest common ancestor, serialize/deserialize binary tree, and binary search trees. Frequent graph problems involve finding connected components, cloning graphs, and water flow. Dynamic programming problems like word break, interval scheduling, and edit distance also appear frequently.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views21 pages

DP Mostly Asked Questions Sorted by Frequency

The document lists the top LeetCode problems sorted by frequency. It shows the problem title, acceptance rate, difficulty, and frequency for each of the top problems. Many of the most frequent problems involve trees, graphs, and dynamic programming. Common tree problems include binary tree traversal, lowest common ancestor, serialize/deserialize binary tree, and binary search trees. Frequent graph problems involve finding connected components, cloning graphs, and water flow. Dynamic programming problems like word break, interval scheduling, and edit distance also appear frequently.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

DP Mostly asked questions sorted by frequency

Acceptanc
# Title e Difficulty Frequency

5 Longest Palindromic Substring 31.3% Medium

10 Regular Expression Matching 27.9% Hard

22 Generate Parentheses 68.0% Medium

32 Longest Valid Parentheses 30.6% Hard

42 Trapping Rain Water 53.8% Hard

44 Wildcard Matching 26.0% Hard

45 Jump Game II 34.6% Medium

53 Maximum Subarray 48.7% Easy

55 Jump Game 36.3% Medium

62 Unique Paths 57.8% Medium

63 Unique Paths II 36.5% Medium


64 Minimum Path Sum 57.8% Medium

70 Climbing Stairs 49.6% Easy

72 Edit Distance 48.9% Hard

85 Maximal Rectangle 40.8% Hard

87 Scramble String 35.2% Hard

91 Decode Ways 28.6% Medium

95 Unique Binary Search Trees II 47.0% Medium

96 Unique Binary Search Trees 56.1% Medium

97 Interleaving String 34.0% Medium

115 Distinct Subsequences 41.5% Hard

118 Pascal's Triangle 59.6% Easy

119 Pascal's Triangle II 54.5% Easy

120 Triangle 48.3% Medium

121 Best Time to Buy and Sell Stock 52.7% Easy


122 Best Time to Buy and Sell Stock II 60.1% Medium

123 Best Time to Buy and Sell Stock III 41.4% Hard

124 Binary Tree Maximum Path Sum 36.6% Hard

131 Palindrome Partitioning 55.4% Medium

132 Palindrome Partitioning II 32.7% Hard

139 Word Break 43.1% Medium

140 Word Break II 38.6% Hard

152 Maximum Product Subarray 33.5% Medium

174 Dungeon Game 34.3% Hard

188 Best Time to Buy and Sell Stock IV 31.6% Hard


GRAPH FAQs

Acceptanc
# Title e Difficulty Frequency

200 Number of Islands 51.7% Medium

127 Word Ladder 33.6% Hard

144 Count Good Nodes in Binary Tree 73.0% Medium

210 Course Schedule II 44.6% Medium

815 Bus Routes 44.4% Hard

909 Snakes and Ladders 39.5% Medium

863 All Nodes Distance K in Binary Tree 59.5% Medium

529 Minesweeper 63.2% Medium

322 Coin Change 38.8% Medium

119 Minimum Knight Moves 38.9% Medium

269 Alien Dictionary 34.3% Hard


297 Serialize and Deserialize Binary 51.9% Hard

Tree

695 Max Area of Island 67.8% Medium

207 Course Schedule 44.6% Medium

721 Accounts Merge 53.9% Medium

994 Rotting Oranges 50.3% Medium

547 Number of Provinces 62.0% Medium

364 Nested List Weight Sum II 65.8% Medium

987 Vertical Order Traversal of a Binary 39.6% Hard

Tree

301 Remove Invalid Parentheses 45.8% Hard

827 Making A Large Island 44.2% Hard

199 Binary Tree Right Side View 58.0% Medium

329 Longest Increasing Path in a Matrix 48.0% Hard

103 Binary Tree Zigzag Level Order 51.9% Medium

Traversal
126 Word Ladder II 25.6% Hard

934 Shortest Bridge 51.5% Medium

428 Serialize and Deserialize N-ary Tree 63.2% Hard

109 Shortest Path in Binary Matrix 41.2% Medium

339 Nested List Weight Sum 78.1% Medium

407 Trapping Rain Water II 45.6% Hard

314 Binary Tree Vertical Order Traversal 48.8% Medium

133 Clone Graph 42.9% Medium

694 Number of Distinct Islands 58.9% Medium

787 Cheapest Flights Within K Stops 37.0% Medium

399 Evaluate Division 55.8% Medium

417 Pacific Atlantic Water Flow 46.2% Medium

749 Contain Virus 49.3% Hard

959 Regions Cut By Slashes 68.1% Medium


102 Binary Tree Level Order Traversal 58.9% Medium

662 Maximum Width of Binary Tree 39.5% Medium

323 Number of Connected 59.6% Medium

Components in an Undirected
Graph

Trees FAQ
Difficult
# Title Acceptance y Frequency

124 Binary Tree Maximum Path Sum 36.8% Hard

1448 Count Good Nodes in Binary Tree 73.0% Medium

236 Lowest Common Ancestor of a 52.6% Medium

Binary Tree

863 All Nodes Distance K in Binary 59.8% Medium

Tree

297 Serialize and Deserialize Binary 52.1% Hard

Tree

341 Flatten Nested List Iterator 57.4% Medium

199 Binary Tree Right Side View 58.2% Medium

987 Vertical Order Traversal of a 39.8% Hard

Binary Tree

1650 Lowest Common Ancestor of a 77.4% Medium

Binary Tree III


938 Range Sum of BST 84.0% Easy

426 Convert Binary Search Tree to 63.3% Medium

Sorted Doubly Linked List

103 Binary Tree Zigzag Level Order 52.1% Medium

Traversal

173 Binary Search Tree Iterator 63.2% Medium

314 Binary Tree Vertical Order 49.1% Medium

Traversal

98 Validate Binary Search Tree 29.7% Medium

96 Unique Binary Search Trees 56.3% Medium

99 Recover Binary Search Tree 44.8% Medium

1569 Number of Ways to Reorder Array 49.8% Hard

to Get Same BST

1110 Delete Nodes And Return Forest 68.8% Medium

894 All Possible Full Binary Trees 78.8% Medium

979 Distribute Coins in Binary Tree 70.6% Medium


427 Construct Quad Tree 63.9% Medium

543 Diameter of Binary Tree 52.3% Easy

428 Serialize and Deserialize N-ary 63.4% Hard

Tree

834 Sum of Distances in Tree 52.3% Hard

105 Construct Binary Tree from 55.4% Medium

Preorder and Inorder Traversal

114 Flatten Binary Tree to Linked List 55.6% Medium

102 Binary Tree Level Order Traversal 59.1% Medium

662 Maximum Width of Binary Tree 39.6% Medium

968 Binary Tree Cameras 41.2% Hard

450 Delete Node in a BST 46.9% Medium

101 Symmetric Tree 50.2% Easy

545 Boundary of Binary Tree 41.9% Medium

2003 Smallest Missing Genetic Value in 40.6% Hard


Each Subtree

95 Unique Binary Search Trees II 47.3% Medium

366 Find Leaves of Binary Tree 74.9% Medium

226 Invert Binary Tree 69.7% Easy

897 Increasing Order Search Tree 75.5% Easy

703 Kth Largest Element in a Stream 51.9% Easy

1382 Balance a Binary Search Tree 78.7% Medium

889 Construct Binary Tree from 69.0% Medium

Preorder and Postorder Traversal

971 Flip Binary Tree To Match 49.8% Medium

Preorder Traversal

116 Populating Next Right Pointers in 53.0% Medium

Each Node

337 House Robber III 52.4% Medium

449 Serialize and Deserialize BST 55.4% Medium


129 Sum Root to Leaf Numbers 53.7% Medium

108 Convert Sorted Array to Binary 64.1% Easy

Search Tree

814 Binary Tree Pruning 71.1% Medium

1628 Design an Expression Tree With 81.6% Medium

Evaluate Function

94 Binary Tree Inorder Traversal 68.7% Easy

272 Closest Binary Search Tree Value II 54.7% Hard

1740 Find Distance in a Binary Tree 68.5% Medium

572 Subtree of Another Tree 44.9% Easy

1932 Merge BSTs to Create Single BST 33.5% Hard

110 Balanced Binary Tree 45.8% Easy

538 Convert BST to Greater Tree 61.6% Medium

100 Same Tree 54.9% Easy

117 Populating Next Right Pointers in 44.5% Medium


Each Node II

235 Lowest Common Ancestor of a 54.9% Easy

Binary Search Tree

1483 Kth Ancestor of a Tree Node 33.1% Hard

437 Path Sum III 49.6% Medium

652 Find Duplicate Subtrees 54.7% Medium

331 Verify Preorder Serialization of a 43.3% Medium

Binary Tree

113 Path Sum II 52.3% Medium

582 Kill Process 65.2% Medium

270 Closest Binary Search Tree Value 52.3% Easy

501 Find Mode in Binary Search Tree 45.7% Easy

1120 Maximum Average Subtree 64.8% Medium

230 Kth Smallest Element in a BST 65.0% Medium

617 Merge Two Binary Trees 76.8% Easy


1522 Diameter of N-Ary Tree 71.3% Medium

958 Check Completeness of a Binary 52.9% Medium

Tree

1161 Maximum Level Sum of a Binary 67.0% Medium

Tree

513 Find Bottom Left Tree Value 64.0% Medium

104 Maximum Depth of Binary Tree 70.1% Easy

1373 Maximum Sum BST in Binary Tree 37.9% Hard

1028 Recover a Tree From Preorder 71.8% Hard

Traversal

1376 Time Needed to Inform All 57.9% Medium

Employees

1916 Count Ways to Build Rooms in an 49.1% Hard

Ant Colony

1022 Sum of Root To Leaf Binary 72.2% Easy

Numbers

671 Second Minimum Node In a 43.2% Easy

Binary Tree
919 Complete Binary Tree Inserter 62.1% Medium

298 Binary Tree Longest Consecutive 49.6% Medium

Sequence

536 Construct Binary Tree from String 54.3% Medium

285 Inorder Successor in BST 45.3% Medium

106 Construct Binary Tree from 52.5% Medium

Inorder and Postorder Traversal

333 Largest BST Subtree 39.8% Medium

109 Convert Sorted List to Binary 53.8% Medium

Search Tree

783 Minimum Distance Between BST 55.2% Easy

Nodes

515 Find Largest Value in Each Tree 63.6% Medium

Row

655 Print Binary Tree 57.9% Medium

112 Path Sum 44.1% Easy


637 Average of Levels in Binary Tree 67.4% Easy

1339 Maximum Product of Splitted 42.3% Medium

Binary Tree

669 Trim a Binary Search Tree 64.4% Medium

111 Minimum Depth of Binary Tree 41.3% Easy

1008 Construct Binary Search Tree from 79.8% Medium

Preorder Traversal

1519 Number of Nodes in the Sub-Tree 38.6% Medium

With the Same Label

1993 Operations on Tree 39.6% Medium

530 Minimum Absolute Difference in 55.7% Easy

BST

1026 Maximum Difference Between 70.7% Medium

Node and Ancestor

1485 Clone Binary Tree With Random 79.3% Medium

Pointer

222 Count Complete Tree Nodes 53.3% Medium


257 Binary Tree Paths 56.5% Easy

1302 Deepest Leaves Sum 85.6% Medium

1372 Longest ZigZag Path in a Binary 56.6% Medium

Tree

951 Flip Equivalent Binary Trees 66.4% Medium

1315 Sum of Nodes with Even-Valued 84.8% Medium

Grandparent

1377 Frog Position After T Seconds 36.0% Hard

156 Binary Tree Upside Down 58.2% Medium

1038 Binary Search Tree to Greater Sum 83.9% Medium

Tree

865 Smallest Subtree with all the 66.5% Medium

Deepest Nodes

1325 Delete Leaves With a Given Value 74.6% Medium

1530 Number of Good Leaf Nodes Pairs 58.6% Medium

510 Inorder Successor in BST II 61.4% Medium


653 Two Sum IV - Input is a BST 57.9% Easy

1600 Throne Inheritance 62.1% Medium

1766 Tree of Coprimes 37.5% Hard

1123 Lowest Common Ancestor of 69.1% Medium

Deepest Leaves

1644 Lowest Common Ancestor of a 57.7% Medium

Binary Tree II

654 Maximum Binary Tree 82.6% Medium

559 Maximum Depth of N-ary Tree 70.3% Easy

250 Count Univalue Subtrees 54.2% Medium

742 Closest Leaf in a Binary Tree 44.8% Medium

508 Most Frequent Subtree Sum 61.3% Medium

1902 Depth of BST Given Insertion 48.6% Medium

Order

1443 Minimum Time to Collect All 55.3% Medium

Apples in a Tree
107 Binary Tree Level Order Traversal 57.2% Medium

II

1586 Binary Search Tree Iterator II 67.5% Medium

776 Split BST 57.8% Medium

1245 Tree Diameter 61.9% Medium

1145 Binary Tree Coloring Game 51.0% Medium

1257 Smallest Common Region 61.9% Medium

255 Verify Preorder Sequence in 47.0% Medium

Binary Search Tree

993 Cousins in Binary Tree 53.6% Easy

1361 Validate Binary Tree Nodes 42.0% Medium

988 Smallest String Starting From Leaf 47.9% Medium

687 Longest Univalue Path 38.6% Medium

1305 All Elements in Two Binary Search 78.5% Medium

Trees
404 Sum of Left Leaves 53.2% Easy

1379 Find a Corresponding Node of a 85.1% Medium

Binary Tree in a Clone of That Tree

549 Binary Tree Longest Consecutive 48.3% Medium

Sequence II

429 N-ary Tree Level Order Traversal 68.1% Medium

1104 Path In Zigzag Labelled Binary 74.0% Medium

Tree

1506 Find Root of N-Ary Tree 78.7% Medium

872 Leaf-Similar Trees 64.7% Easy

701 Insert into a Binary Search Tree 74.8% Medium

1676 Lowest Common Ancestor of a 79.0% Medium

Binary Tree IV

145 Binary Tree Postorder Traversal 61.1% Easy

1367 Linked List in Binary Tree 42.2% Medium

589 N-ary Tree Preorder Traversal 75.2% Easy


965 Univalued Binary Tree 68.5% Easy

998 Maximum Binary Tree II 64.8% Medium

1490 Clone N-ary Tree 82.8% Medium

700 Search in a Binary Search Tree 74.3% Easy

1080 Insufficient Nodes in Root to Leaf 51.0% Medium

Paths

You might also like