Leetcode problems for apple

LeetCode Problems for Apple

Most of the time computer science graduate students dream about working in big tech giants like Google, Facebook, Apple, Microsoft, etc. But it is hard to predict which problem you will be given in the interview session. In this article we’ve gathered a list of popular LeetCode Problems for Apple. Hope it will help you in your interview.

IDTitleAcceptanceDifficultyFrequency
1Two Sum45.6%Easy2.441653
146LRU Cache33.2%Medium2.288507
403Frog Jump39.7%Hard2.135361
54Spiral Matrix34.1%Medium1.982215
2Add Two Numbers33.9%Medium1.937580
284Peeking Iterator45.7%Medium1.898847
4Median of Two Sorted Arrays29.6%Hard1.745701
53Maximum Subarray46.5%Easy1.603979
341Flatten Nested List Iterator52.9%Medium1.596120
42Trapping Rain Water48.9%Hard1.450492
391Perfect Rectangle30.5%Hard1.297346
206Reverse Linked List62.5%Easy1.288954
295Find Median from Data Stream44.3%Hard1.241562
200Number of Islands46.8%Medium1.233667
5Longest Palindromic Substring29.5%Medium1.204982
218The Skyline Problem34.6%Hard1.202681
1095Find in Mountain Array35.8%Hard1.201355
97Interleaving String31.5%Hard1.187919
479Largest Palindrome Product29.0%Hard1.170071
393UTF-8 Validation37.5%Medium1.156069
238Product of Array Except Self60.1%Medium1.125997
311Sparse Matrix Multiplication61.9%Medium1.108395
8String to Integer (atoi)15.4%Medium1.072824
428Serialize and Deserialize N-ary Tree59.4%Hard1.069717
348Design Tic-Tac-Toe54.3%Medium1.019148
56Merge Intervals39.3%Medium1.015656
153Sum26.8%Medium1.002806
202Happy Number50.4%Easy0.997486
329Longest Increasing Path in a Matrix43.4%Hard0.967887
49Group Anagrams56.9%Medium0.956170
23Merge k Sorted Lists40.2%Hard0.902412
3Longest Substring Without Repeating Characters30.4%Medium0.875951
21Merge Two Sorted Lists53.5%Easy0.833102
139Word Break40.1%Medium0.786184
351Android Unlock Patterns48.4%Medium0.785739
20Valid Parentheses39.0%Easy0.772884
269Alien Dictionary33.3%Hard0.768398
212Word Search II34.9%Hard0.737534
149Max Points on a Line16.9%Hard0.724109
33Search in Rotated Sorted Array34.5%Medium0.716963
48Rotate Image56.7%Medium0.693785
242Valid Anagram56.9%Easy0.693199
7Reverse Integer25.8%Easy0.664301
204Count Primes31.5%Easy0.661970
17Letter Combinations of a Phone Number46.8%Medium0.656244
227Basic Calculator II36.9%Medium0.642608
412Fizz Buzz62.3%Easy0.626040
121Best Time to Buy and Sell Stock50.5%Easy0.615442
472Concatenated Words43.7%Hard0.614389
387First Unique Character in a String53.4%Easy0.599968
688Knight Probability in Chessboard48.9%Medium0.581062
281Zigzag Iterator58.4%Medium0.566560
344Reverse String68.5%Easy0.552078
380Insert Delete GetRandom O(1)47.5%Medium0.538276
12Integer to Roman55.1%Medium0.527144
322Coin Change35.5%Medium0.520230
545Boundary of Binary Tree38.9%Medium0.518439
394Decode String50.0%Medium0.509348
36Valid Sudoku48.7%Medium0.505273
297Serialize and Deserialize Binary Tree47.5%Hard0.495293
236Lowest Common Ancestor of a Binary Tree45.7%Medium0.485462
125Valid Palindrome36.7%Easy0.484395
251Flatten 2D Vector45.7%Medium0.480879
45Jump Game II30.6%Hard0.478659
46Permutations63.5%Medium0.475258
191Number of 1 Bits49.8%Easy0.474703
14Longest Common Prefix35.4%Easy0.473831
31Next Permutation32.6%Medium0.470491
771Jewels and Stones86.4%Easy0.465125
724Find Pivot Index44.0%Easy0.463269
336Palindrome Pairs33.7%Hard0.462623
155Min Stack44.5%Easy0.421871
177Nth Highest Salary31.4%Medium0.419481
253Meeting Rooms II45.7%Medium0.418160
273Integer to English Words27.1%Hard0.414439
460LFU Cache34.2%Hard0.407559
836Rectangle Overlap48.6%Easy0.403214
1229Meeting Scheduler52.7%Medium0.402250
13Roman to Integer55.7%Easy0.401852
175Combine Two Tables60.8%Easy0.401788
419Battleships in a Board70.0%Medium0.393343
909Snakes and Ladders38.4%Medium0.389778
733Flood Fill55.3%Easy0.389737
981Time Based Key-Value Store53.1%Medium0.375572
279Perfect Squares47.4%Medium0.374114
138Copy List with Random Pointer36.4%Medium0.370658
388Longest Absolute File Path41.8%Medium0.369634
168Excel Sheet Column Title31.1%Easy0.362867
88Merge Sorted Array39.4%Easy0.360556
141Linked List Cycle41.1%Easy0.353107
184Sum33.7%Medium0.349179
609Find Duplicate File in System59.5%Medium0.347966
51N-Queens46.6%Hard0.345873
694Number of Distinct Islands56.0%Medium0.342406
102Binary Tree Level Order Traversal54.6%Medium0.337851
76Minimum Window Substring34.6%Hard0.336516
59Spiral Matrix II53.9%Medium0.334993
233Number of Digit One31.3%Hard0.334343
268Missing Number51.7%Easy0.333812
195Tenth Line33.0%Easy0.332854
140Word Break II32.6%Hard0.329555
333Largest BST Subtree35.8%Medium0.329314
32Longest Valid Parentheses28.4%Hard0.326946
38Count and Say44.6%Easy0.325804
384Shuffle an Array52.8%Medium0.325102
127Word Ladder29.6%Medium0.324839
163Sum Closest46.0%Medium0.314927
692Top K Frequent Words51.8%Medium0.314571
706Design HashMap61.3%Easy0.306079
10Regular Expression Matching26.8%Hard0.302625
24Swap Nodes in Pairs50.4%Medium0.300895
283Move Zeroes57.8%Easy0.299834
179Largest Number28.8%Medium0.299393
332Reconstruct Itinerary36.7%Medium0.297330
193Valid Phone Numbers25.3%Easy0.296265
34Find First and Last Position of Element in Sorted Array36.2%Medium0.296238
68Text Justification27.7%Hard0.295187
232Implement Queue using Stacks49.6%Easy0.294161
171Excel Sheet Column Number55.9%Easy0.293085
401Binary Watch47.5%Easy0.291396
300Longest Increasing Subsequence42.6%Medium0.291041
91Decode Ways24.7%Medium0.290222
796Rotate String49.6%Easy0.289220
239Sliding Window Maximum43.0%Hard0.288969
729My Calendar I51.8%Medium0.288145
463Island Perimeter65.7%Easy0.287132
996Number of Squareful Arrays47.8%Hard0.286759
973K Closest Points to Origin63.8%Medium0.281947
39Combination Sum56.1%Medium0.279479
75Sort Colors47.3%Medium0.277874
136Single Number65.5%Easy0.275229
41First Missing Positive32.0%Hard0.273960
362Design Hit Counter63.7%Medium0.273768
11Container With Most Water50.8%Medium0.267920
486Predict the Winner47.9%Medium0.263569
221Maximal Square37.7%Medium0.262784
223Rectangle Area37.8%Medium0.257829
315Count of Smaller Numbers After Self41.5%Hard0.256760
187Repeated DNA Sequences38.9%Medium0.252911
443String Compression41.3%Easy0.249679
22Generate Parentheses62.7%Medium0.246641
316Remove Duplicate Letters35.8%Hard0.245458
895Maximum Frequency Stack60.6%Hard0.244160
415Add Strings47.5%Easy0.242303
277Find the Celebrity41.8%Medium0.240031
167Two Sum II – Input array is sorted54.1%Easy0.239494
658Find K Closest Elements40.9%Medium0.237446
381Insert Delete GetRandom O(1) – Duplicates allowed34.1%Hard0.234938
92Reverse Linked List II38.8%Medium0.232740
636Exclusive Time of Functions52.0%Medium0.231288
509Fibonacci Number67.2%Easy0.228732
165Compare Version Numbers27.4%Medium0.226877
28Implement strStr()34.5%Easy0.225432
237Delete Node in a Linked List63.8%Easy0.225333
104Maximum Depth of Binary Tree66.0%Easy0.224705
498Diagonal Traverse48.2%Medium0.224400
69Sqrt(x)33.9%Easy0.223654
215Kth Largest Element in an Array55.4%Medium0.223339
353Design Snake Game34.2%Medium0.222831
133Clone Graph34.8%Medium0.220853
9Palindrome Number48.4%Easy0.220294
986Interval List Intersections67.3%Medium0.218194
229Majority Element II35.6%Medium0.211629
108Convert Sorted Array to Binary Search Tree57.9%Easy0.211322
661Image Smoother51.5%Easy0.211060
124Binary Tree Maximum Path Sum34.3%Hard0.210555
6ZigZag Conversion36.3%Medium0.210405
741Cherry Pickup33.9%Hard0.209091
169Majority Element58.7%Easy0.207956
837New 21 Game34.6%Medium0.205263
62Unique Paths54.1%Medium0.204537
220Contains Duplicate III20.9%Medium0.204327
37Sudoku Solver43.6%Hard0.203090
543Diameter of Binary Tree48.4%Easy0.202748
557Reverse Words in a String III69.8%Easy0.199853
349Intersection of Two Arrays62.5%Easy0.198949
120Triangle44.2%Medium0.193254
173Binary Search Tree Iterator56.6%Medium0.193202
65Valid Number15.3%Hard0.189042
25Reverse Nodes in k-Group42.1%Hard0.188843
549Binary Tree Longest Consecutive Sequence II47.0%Medium0.188447
178Rank Scores45.8%Medium0.188439
72Edit Distance44.8%Hard0.185546
77Combinations54.7%Medium0.184056
518Coin Change 250.2%Medium0.183738
231Power of Two43.7%Easy0.180771
234Palindrome Linked List39.3%Easy0.175615
240Search a 2D Matrix II43.2%Medium0.174201
911Online Election50.4%Medium0.174184
74Search a 2D Matrix36.5%Medium0.173996
1278Palindrome Partitioning III59.9%Hard0.172842
151Reverse Words in a String21.9%Medium0.170740
43Multiply Strings33.9%Medium0.170616
176Second Highest Salary31.6%Easy0.170188
190Reverse Bits39.8%Easy0.168336
528Random Pick with Weight43.9%Medium0.168088
55Jump Game34.6%Medium0.166589
642Design Search Autocomplete System44.7%Hard0.163127
821Shortest Distance to a Character66.9%Easy0.162298
29Divide Two Integers16.4%Medium0.156913
647Palindromic Substrings60.6%Medium0.154673
632Smallest Range Covering Elements from K Lists52.4%Hard0.152839
470Implement Rand10() Using Rand7()46.3%Medium0.151549
57Insert Interval33.5%Hard0.149944
739Daily Temperatures63.3%Medium0.149566
383Ransom Note53.1%Easy0.148420
83Remove Duplicates from Sorted List45.4%Easy0.147848
30Substring with Concatenation of All Words25.4%Hard0.146117
546Remove Boxes42.7%Hard0.143615
116Populating Next Right Pointers in Each Node45.2%Medium0.138993
1108Defanging an IP Address87.5%Easy0.138921
687Longest Univalue Path36.2%Easy0.138572
128Longest Consecutive Sequence45.1%Hard0.135830
427Construct Quad Tree61.4%Medium0.135801
1044Longest Duplicate Substring31.9%Hard0.135137
86Partition List41.5%Medium0.133829
199Binary Tree Right Side View54.1%Medium0.133192
1221Split a String in Balanced Strings83.3%Easy0.131932
977Squares of a Sorted Array72.1%Easy0.131336
118Pascal’s Triangle52.5%Easy0.128523
70Climbing Stairs47.8%Easy0.127726
198House Robber42.0%Easy0.127098
359Logger Rate Limiter70.8%Easy0.124850
350Intersection of Two Arrays II51.4%Easy0.122747
1114Print in Order65.7%Easy0.121360
211Add and Search Word – Data structure design38.1%Medium0.120926
4544Sum II53.1%Medium0.120803
867Transpose Matrix62.8%Easy0.119277
93Restore IP Addresses35.6%Medium0.117561
101Symmetric Tree46.8%Easy0.115838
184Department Highest Salary36.7%Medium0.111723
82Remove Duplicates from Sorted List II36.8%Medium0.111088
450Delete Node in a BST43.1%Medium0.110585
219Contains Duplicate II37.7%Easy0.109431
78Subsets62.0%Medium0.105942
114Flatten Binary Tree to Linked List49.3%Medium0.105014
407Trapping Rain Water II42.4%Hard0.104868
448Find All Numbers Disappeared in an Array55.9%Easy0.104533
343Integer Break50.4%Medium0.104465
560Subarray Sum Equals K43.9%Medium0.101848
453Minimum Moves to Equal Array Elements50.2%Easy0.101782
416Partition Equal Subset Sum43.7%Medium0.101536
417Pacific Atlantic Water Flow41.1%Medium0.100083
143Reorder List37.1%Medium0.099695
162Find Peak Element43.3%Medium0.097060
230Kth Smallest Element in a BST60.2%Medium0.096854
207Course Schedule43.1%Medium0.096011
338Counting Bits69.5%Medium0.093941
87Scramble String33.7%Hard0.093331
266Palindrome Permutation61.9%Easy0.091248
282Expression Add Operators35.5%Hard0.087201
622Design Circular Queue43.7%Medium0.086964
256Paint House52.1%Easy0.086509
105Construct Binary Tree from Preorder and Inorder Traversal48.8%Medium0.086458
98Validate Binary Search Tree27.8%Medium0.085425
287Find the Duplicate Number55.5%Medium0.084583
345Reverse Vowels of a String44.2%Easy0.084139
582Kill Process60.8%Medium0.083555
73Set Matrix Zeroes43.1%Medium0.082719
26Remove Duplicates from Sorted Array45.1%Easy0.079294
208Implement Trie (Prefix Tree)49.4%Medium0.079109
180Consecutive Numbers39.7%Medium0.078510
79Word Search35.6%Medium0.078477
142Linked List Cycle II37.3%Medium0.077595
435Non-overlapping Intervals42.9%Medium0.075650
540Single Element in a Sorted Array57.9%Medium0.074731
445Add Two Numbers II54.5%Medium0.074683
669Trim a Binary Search Tree63.0%Easy0.074452
480Sliding Window Median37.2%Hard0.074352
515Find Largest Value in Each Tree Row61.1%Medium0.074280
19Remove Nth Node From End of List35.2%Medium0.074207
721Accounts Merge48.8%Medium0.073494
153Find Minimum in Rotated Sorted Array45.1%Medium0.073435
617Merge Two Binary Trees74.1%Easy0.072016
35Search Insert Position42.6%Easy0.071876
442Find All Duplicates in an Array67.8%Medium0.070831
378Kth Smallest Element in a Sorted Matrix54.3%Medium0.070590
126Word Ladder II22.1%Hard0.070111
54201 Matrix39.8%Medium0.070019
123Best Time to Buy and Sell Stock III37.5%Hard0.068388
1011Capacity To Ship Packages Within D Days58.1%Medium0.066494
863All Nodes Distance K in Binary Tree55.4%Medium0.066167
94Binary Tree Inorder Traversal63.3%Medium0.065839
122Best Time to Buy and Sell Stock II57.0%Easy0.065829
95Unique Binary Search Trees II40.6%Medium0.065786
135Candy31.6%Hard0.065765
326Power of Three42.1%Easy0.063537
772Basic Calculator III41.3%Hard0.063312
110Balanced Binary Tree43.5%Easy0.061536
1002Find Common Characters67.6%Easy0.059741
103Binary Tree Zigzag Level Order Traversal48.3%Medium0.059736
561Array Partition I72.0%Easy0.059408
931Minimum Falling Path Sum62.5%Medium0.059149
890Find and Replace Pattern73.4%Medium0.056833
301Remove Invalid Parentheses43.3%Hard0.056652
912Sort an Array63.9%Medium0.056512
371Sum of Two Integers50.7%Medium0.055110
304Range Sum Query 2D – Immutable38.6%Medium0.054527
594Longest Harmonious Subsequence46.6%Easy0.054435
63Unique Paths II34.6%Medium0.053249
1315Sum of Nodes with Even-Valued Grandparent83.5%Medium0.053172
134Gas Station38.5%Medium0.053045
1275Find Winner on a Tic Tac Toe Game52.8%Easy0.052922
767Reorganize String48.7%Medium0.052163
695Max Area of Island62.7%Medium0.049807
50Pow(x;n)30.3%Medium0.049262
709To Lower Case79.3%Easy0.048909
621Task Scheduler50.1%Medium0.046384
166Fraction to Recurring Decimal21.6%Medium0.044783
347Top K Frequent Elements61.2%Medium0.043992
490The Maze51.4%Medium0.042879
674Longest Continuous Increasing Subsequence45.9%Easy0.042259
430Flatten a Multilevel Doubly Linked List55.1%Medium0.041542
907Sum of Subarray Minimums32.3%Medium0.040697
1060Missing Element in Sorted Array54.5%Medium0.038797
47Permutations II46.4%Medium0.038145
210Course Schedule II40.7%Medium0.037957
40Combination Sum II48.2%Medium0.037775
64Minimum Path Sum54.5%Medium0.037694
1021Remove Outermost Parentheses78.0%Easy0.036604
374Guess Number Higher or Lower43.1%Easy0.034223
886Possible Bipartition44.2%Medium0.034103
226Invert Binary Tree65.0%Easy0.033938
112Path Sum41.2%Easy0.033704
217Contains Duplicate56.0%Easy0.033673
516Longest Palindromic Subsequence53.2%Medium0.033287
1146Snapshot Array37.0%Medium0.031799
703Kth Largest Element in a Stream49.7%Easy0.031004
530Minimum Absolute Difference in BST53.8%Easy0.030677
876Middle of the Linked List68.4%Easy0.030156
1197Minimum Knight Moves36.1%Medium0.029697
938Range Sum of BST81.3%Easy0.027755
811Subdomain Visit Count69.9%Easy0.027721
67Add Binary45.2%Easy0.026266
373Find K Pairs with Smallest Sums36.7%Medium0.026265
111Minimum Depth of Binary Tree37.4%Easy0.026222
961N-Repeated Element in Size 2N Array73.7%Easy0.025609
1038Binary Search Tree to Greater Sum Tree80.8%Medium0.025446
310Minimum Height Trees32.3%Medium0.024466
804Unique Morse Code Words77.0%Easy0.024332
286Walls and Gates54.5%Medium0.023243
766Toeplitz Matrix65.1%Easy0.022806
113Path Sum II46.7%Medium0.021882
905Sort Array By Parity74.1%Easy0.021480
670Maximum Swap43.6%Medium0.020844
60Permutation Sequence38.4%Hard0.020471
66Plus One43.0%Easy0.020215
525Contiguous Array42.8%Medium0.019753
700Search in a Binary Search Tree73.1%Easy0.019052
209Minimum Size Subarray Sum38.2%Medium0.018832
406Queue Reconstruction by Height66.9%Medium0.017746
100Same Tree53.4%Easy0.017112
628Maximum Product of Three Numbers47.1%Easy0.016529
188Best Time to Buy and Sell Stock IV28.0%Hard0.016515
203Remove Linked List Elements38.6%Easy0.014519
107Binary Tree Level Order Traversal II53.5%Easy0.014395
258Add Digits57.6%Easy0.012859
181Employees Earning More Than Their Managers56.9%Easy0.012618
257Binary Tree Paths51.5%Easy0.010457
819Most Common Word44.8%Easy0.010269
96Unique Binary Search Trees52.9%Medium0.009242
937Reorder Data in Log Files54.3%Easy0.008415
763Partition Labels76.1%Medium0.008385
260Single Number III64.3%Medium0.008090
309Best Time to Buy and Sell Stock with Cooldown47.4%Medium0.006400
565Array Nesting55.5%Medium0

Leave a Reply