Visa LeetCode Questions
146 questions all-time · 32 easy · 92 medium · 22 hard
| # | Problem | Difficulty | Frequency | Acceptance |
|---|---|---|---|---|
| 1 | Text Justification Array, String, Simulation | Hard | 100 | 0.5% |
| 2 | Length of Longest V-Shaped Diagonal Segment Array, Dynamic Programming, Memoization, Matrix | Hard | 99 | 0.6% |
| 3 | Rotating the Box Array, Two Pointers, Matrix | Medium | 97 | 0.8% |
| 4 | Two Sum Array, Hash Table | Easy | 96 | 0.6% |
| 5 | Split the Array Array, Hash Table, Counting | Easy | 94 | 0.6% |
| 6 | Longest Substring Without Repeating Characters Hash Table, String, Sliding Window | Medium | 93 | 0.4% |
| 7 | 3Sum Array, Two Pointers, Sorting | Medium | 93 | 0.4% |
| 8 | Minimum Operations to Write the Letter Y on a Grid Array, Hash Table, Matrix, Counting | Medium | 93 | 0.6% |
| 9 | Find the Length of the Longest Common Prefix Array, Hash Table, String, Trie | Medium | 90 | 0.6% |
| 10 | Best Time to Buy and Sell Stock Array, Dynamic Programming | Easy | 87 | 0.6% |
| 11 | LRU Cache Hash Table, Linked List, Design, Doubly-Linked List | Medium | 87 | 0.5% |
| 12 | Create Target Array in the Given Order Array, Simulation | Easy | 83 | 0.9% |
| 13 | Block Placement Queries Array, Binary Search, Binary Indexed Tree, Segment Tree, Ordered Set | Hard | 83 | 0.4% |
| 14 | Number of Black Blocks Array, Hash Table, Enumeration | Medium | 81 | 0.4% |
| 15 | Group Anagrams Array, Hash Table, String, Sorting | Medium | 78 | 0.7% |
| 16 | Divisor Game Math, Dynamic Programming, Brainteaser, Game Theory | Easy | 78 | 0.7% |
| 17 | Count Nodes With the Highest Score Array, Tree, Depth-First Search, Binary Tree | Medium | 78 | 0.5% |
| 18 | Two Furthest Houses With Different Colors Array, Greedy | Easy | 78 | 0.7% |
| 19 | Earliest Possible Day of Full Bloom Array, Greedy, Sorting | Hard | 78 | 0.7% |
| 20 | Match Alphanumerical Pattern in Matrix I Array, Hash Table, String, Matrix | Medium | 78 | 0.7% |
| 21 | Maximum Number of Events That Can Be Attended Array, Greedy, Sorting, Heap (Priority Queue) | Medium | 78 | 0.4% |
| 22 | Odd String Difference Array, Hash Table, String | Easy | 78 | 0.6% |
| 23 | Simplify Path String, Stack | Medium | 78 | 0.5% |
| 24 | Number of Adjacent Elements With the Same Color Array | Medium | 78 | 0.6% |
| 25 | Merge Intervals Array, Sorting | Medium | 76 | 0.5% |
| 26 | Trapping Rain Water Array, Two Pointers, Dynamic Programming, Stack, Monotonic Stack | Hard | 73 | 0.7% |
| 27 | Maximum Subarray Array, Divide and Conquer, Dynamic Programming | Medium | 73 | 0.5% |
| 28 | Largest Rectangle in Histogram Array, Stack, Monotonic Stack | Hard | 73 | 0.5% |
| 29 | Number of Divisible Triplet Sums Array, Hash Table | Medium | 73 | 0.7% |
| 30 | Maximum Sum of Alternating Subsequence With Distance at Least K Array, Dynamic Programming, Segment Tree | Hard | 73 | 0.3% |
| 31 | Longest Palindromic Substring Two Pointers, String, Dynamic Programming | Medium | 70 | 0.4% |
| 32 | Valid Parentheses String, Stack | Easy | 70 | 0.4% |
| 33 | Number of Islands Array, Depth-First Search, Breadth-First Search, Union-Find, Matrix | Medium | 70 | 0.6% |
| 34 | Longest Common Prefix Array, String, Trie | Easy | 66 | 0.5% |
| 35 | Minimum Time Difference Array, Math, String, Sorting | Medium | 66 | 0.6% |
| 36 | Minimum Absolute Difference Between Elements With Constraint Array, Binary Search, Ordered Set | Medium | 66 | 0.4% |
| 37 | Beautiful Arrangement Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask | Medium | 66 | 0.6% |
| 38 | Walls and Gates Array, Breadth-First Search, Matrix | Medium | 61 | 0.6% |
| 39 | Spiral Matrix Array, Matrix, Simulation | Medium | 61 | 0.6% |
| 40 | Reverse Linked List Linked List, Recursion | Easy | 61 | 0.8% |
| 41 | Rotate Image Array, Math, Matrix | Medium | 61 | 0.8% |
| 42 | Count Palindromic Subsequences String, Dynamic Programming | Hard | 61 | 0.4% |
| 43 | Exclusive Time of Functions Array, Stack | Medium | 61 | 0.7% |
| 44 | Course Schedule Depth-First Search, Breadth-First Search, Graph Theory, Topological Sort | Medium | 56 | 0.5% |
| 45 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit Array, Queue, Sliding Window, Heap (Priority Queue), Ordered Set, Monotonic Queue | Medium | 56 | 0.6% |
| 46 | Restore IP Addresses String, Backtracking | Medium | 56 | 0.6% |
| 47 | Container With Most Water Array, Two Pointers, Greedy | Medium | 56 | 0.6% |
| 48 | Merge Two Sorted Lists Linked List, Recursion | Easy | 56 | 0.7% |
| 49 | Sort Colors Array, Two Pointers, Sorting | Medium | 56 | 0.7% |
| 50 | Happy Number Hash Table, Math, Two Pointers | Easy | 56 | 0.6% |
| 51 | Grid Teleportation Traversal Array, Hash Table, Breadth-First Search, Matrix | Medium | 56 | 0.2% |
| 52 | Matrix Block Sum Array, Matrix, Prefix Sum | Medium | 56 | 0.8% |
| 53 | Gas Station Array, Greedy | Medium | 56 | 0.5% |
| 54 | Subarray Sum Equals K Array, Hash Table, Prefix Sum | Medium | 56 | 0.5% |
| 55 | Number of Changing Keys String | Easy | 56 | 0.8% |
| 56 | Minimum Cost Path with Teleportations Array, Dynamic Programming, Matrix | Hard | 56 | 0.5% |
| 57 | Number of Perfect Pairs Array, Math, Two Pointers, Sorting | Medium | 56 | 0.3% |
| 58 | Divide Players Into Teams of Equal Skill Array, Hash Table, Two Pointers, Sorting | Medium | 56 | 0.7% |
| 59 | Maximum OR Array, Greedy, Bit Manipulation, Prefix Sum | Medium | 56 | 0.4% |
| 60 | Minimum Number of Swaps to Make the String Balanced Two Pointers, String, Stack, Greedy | Medium | 56 | 0.8% |
| 61 | Check If Array Pairs Are Divisible by k Array, Hash Table, Counting | Medium | 49 | 0.5% |
| 62 | Diameter of Binary Tree Tree, Depth-First Search, Binary Tree | Easy | 49 | 0.7% |
| 63 | Image Smoother Array, Matrix | Easy | 49 | 0.7% |
| 64 | Top K Frequent Elements Array, Hash Table, Divide and Conquer, Sorting, Heap (Priority Queue), Bucket Sort, Counting, Quickselect | Medium | 49 | 0.7% |
| 65 | Word Ladder Hash Table, String, Breadth-First Search | Hard | 49 | 0.5% |
| 66 | Candy Crush Array, Two Pointers, Matrix, Simulation | Medium | 49 | 0.8% |
| 67 | Partition Equal Subset Sum Array, Dynamic Programming | Medium | 49 | 0.5% |
| 68 | Number of Matching Subsequences Array, Hash Table, String, Binary Search, Dynamic Programming, Trie, Sorting | Medium | 49 | 0.5% |
| 69 | Balanced Binary Tree Tree, Depth-First Search, Binary Tree | Easy | 49 | 0.6% |
| 70 | Find Median from Data Stream Two Pointers, Design, Sorting, Heap (Priority Queue), Data Stream | Hard | 49 | 0.5% |
| 71 | Longest Valid Parentheses String, Dynamic Programming, Stack | Hard | 49 | 0.4% |
| 72 | Best Time to Buy and Sell Stock II Array, Dynamic Programming, Greedy | Medium | 49 | 0.7% |
| 73 | Product of Array Except Self Array, Prefix Sum | Medium | 49 | 0.7% |
| 74 | Add Binary Math, String, Bit Manipulation, Simulation | Easy | 49 | 0.6% |
| 75 | Add Strings Math, String, Simulation | Easy | 49 | 0.5% |
| 76 | Sell Diminishing-Valued Colored Balls Array, Math, Binary Search, Greedy, Sorting, Heap (Priority Queue) | Medium | 49 | 0.3% |
| 77 | Median of Two Sorted Arrays Array, Binary Search, Divide and Conquer | Hard | 39 | 0.5% |
| 78 | Plus One Array, Math | Easy | 39 | 0.5% |
| 79 | Reverse Words in a String Two Pointers, String | Medium | 39 | 0.6% |
| 80 | Daily Temperatures Array, Stack, Monotonic Stack | Medium | 39 | 0.7% |
| 81 | Find Score of an Array After Marking All Elements Array, Hash Table, Sorting, Heap (Priority Queue), Simulation | Medium | 39 | 0.6% |
| 82 | Reverse Nodes in k-Group Linked List, Recursion | Hard | 39 | 0.7% |
| 83 | Rotate Array Array, Math, Two Pointers | Medium | 39 | 0.5% |
| 84 | Valid Anagram Hash Table, String, Sorting | Easy | 39 | 0.7% |
| 85 | Best Time to Buy and Sell Stock III Array, Dynamic Programming | Hard | 39 | 0.5% |
| 86 | Find Peak Element Array, Binary Search | Medium | 39 | 0.5% |
| 87 | Sliding Window Maximum Array, Queue, Sliding Window, Heap (Priority Queue), Monotonic Queue | Hard | 39 | 0.5% |
| 88 | Substrings of Size Three with Distinct Characters Hash Table, String, Sliding Window, Counting | Easy | 39 | 0.8% |
| 89 | Number of Subarrays That Match a Pattern I Array, Rolling Hash, String Matching, Hash Function | Medium | 39 | 0.7% |
| 90 | House Robber II Array, Dynamic Programming | Medium | 39 | 0.5% |
| 91 | Edit Distance String, Dynamic Programming | Medium | 39 | 0.6% |
| 92 | Brightest Position on Street Array, Sorting, Prefix Sum, Ordered Set | Medium | 39 | 0.6% |
| 93 | Contains Duplicate Array, Hash Table, Sorting | Easy | 39 | 0.6% |
| 94 | Sum Root to Leaf Numbers Tree, Depth-First Search, Binary Tree | Medium | 39 | 0.7% |
| 95 | LFU Cache Hash Table, Linked List, Design, Doubly-Linked List | Hard | 39 | 0.5% |
| 96 | Longest Increasing Subsequence Array, Binary Search, Dynamic Programming | Medium | 39 | 0.6% |
| 97 | Sort Characters By Frequency Hash Table, String, Sorting, Heap (Priority Queue), Bucket Sort, Counting | Medium | 39 | 0.8% |
| 98 | Binary Tree Right Side View Tree, Depth-First Search, Breadth-First Search, Binary Tree | Medium | 39 | 0.7% |
| 99 | Check if Array Is Sorted and Rotated Array | Easy | 39 | 0.6% |
| 100 | Kth Largest Element in an Array Array, Divide and Conquer, Sorting, Heap (Priority Queue), Quickselect | Medium | 39 | 0.7% |
| 101 | Reverse Vowels of a String Two Pointers, String | Easy | 39 | 0.6% |
| 102 | Valid Palindrome II Two Pointers, String, Greedy | Easy | 39 | 0.4% |
| 103 | Two Sum II - Input Array Is Sorted Array, Two Pointers, Binary Search | Medium | 39 | 0.7% |
| 104 | Ugly Number II Hash Table, Math, Dynamic Programming, Heap (Priority Queue) | Medium | 39 | 0.5% |
| 105 | Unique Paths Math, Dynamic Programming, Combinatorics | Medium | 39 | 0.7% |
| 106 | Restore the Array From Adjacent Pairs Array, Hash Table, Depth-First Search | Medium | 39 | 0.8% |
| 107 | Letter Combinations of a Phone Number Hash Table, String, Backtracking | Medium | 39 | 0.7% |
| 108 | Reconstruct Itinerary Array, String, Depth-First Search, Graph Theory, Sorting, Heap (Priority Queue), Eulerian Circuit | Hard | 39 | 0.4% |
| 109 | Design Memory Allocator Array, Hash Table, Design, Simulation | Medium | 39 | 0.5% |
| 110 | Last Stone Weight Array, Heap (Priority Queue) | Easy | 39 | 0.7% |
| 111 | Count Mentions Per User Array, Math, Sorting, Simulation | Medium | 39 | 0.5% |
| 112 | Best Time to Buy and Sell Stock using Strategy Array, Sliding Window, Prefix Sum | Medium | 39 | 0.6% |
| 113 | Maximal Rectangle Array, Dynamic Programming, Stack, Matrix, Monotonic Stack | Hard | 39 | 0.6% |
| 114 | Add Digits Math, Simulation, Number Theory | Easy | 39 | 0.7% |
| 115 | Candy Array, Greedy | Hard | 39 | 0.5% |
| 116 | Alternating Digit Sum Math | Easy | 39 | 0.7% |
| 117 | Next Greater Element II Array, Stack, Monotonic Stack | Medium | 39 | 0.7% |
| 118 | Word Search Array, String, Backtracking, Depth-First Search, Matrix | Medium | 39 | 0.5% |
| 119 | Merge Sorted Array Array, Two Pointers, Sorting | Easy | 39 | 0.6% |
| 120 | Rotting Oranges Array, Breadth-First Search, Matrix | Medium | 39 | 0.6% |
| 121 | Subarray Sums Divisible by K Array, Hash Table, Prefix Sum | Medium | 39 | 0.6% |
| 122 | Longest Consecutive Sequence Array, Hash Table, Union-Find | Medium | 39 | 0.5% |
| 123 | Valid Palindrome Two Pointers, String | Easy | 39 | 0.5% |
| 124 | First Unique Character in a String Hash Table, String, Queue, Counting | Easy | 39 | 0.7% |
| 125 | Count Good Numbers Math, Recursion | Medium | 39 | 0.6% |
| 126 | Hand of Straights Array, Hash Table, Greedy, Sorting | Medium | 39 | 0.6% |
| 127 | Non-overlapping Intervals Array, Dynamic Programming, Greedy, Sorting | Medium | 39 | 0.6% |
| 128 | Palindrome Partitioning String, Dynamic Programming, Backtracking | Medium | 39 | 0.7% |
| 129 | Maximal Score After Applying K Operations Array, Greedy, Heap (Priority Queue) | Medium | 39 | 0.6% |
| 130 | Flood Fill Array, Depth-First Search, Breadth-First Search, Matrix | Easy | 39 | 0.7% |
| 131 | Meeting Rooms II Array, Two Pointers, Greedy, Sorting, Heap (Priority Queue), Prefix Sum | Medium | 39 | 0.5% |
| 132 | Word Break Array, Hash Table, String, Dynamic Programming, Trie, Memoization | Medium | 39 | 0.5% |
| 133 | Word Break II Array, Hash Table, String, Dynamic Programming, Backtracking, Trie, Memoization | Hard | 39 | 0.6% |
| 134 | Maximum Palindromes After Operations Array, Hash Table, String, Greedy, Sorting, Counting | Medium | 39 | 0.5% |
| 135 | Jump Game VI Array, Dynamic Programming, Queue, Heap (Priority Queue), Monotonic Queue | Medium | 39 | 0.5% |
| 136 | Path With Minimum Effort Array, Binary Search, Depth-First Search, Breadth-First Search, Union-Find, Heap (Priority Queue), Matrix | Medium | 39 | 0.6% |
| 137 | Capacity To Ship Packages Within D Days Array, Binary Search | Medium | 39 | 0.7% |
| 138 | Minimum Suffix Flips String, Greedy | Medium | 39 | 0.7% |
| 139 | Longest Common Subsequence String, Dynamic Programming | Medium | 39 | 0.6% |
| 140 | Minimize Maximum of Array Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum | Medium | 39 | 0.5% |
| 141 | Binary Tree Level Order Traversal Tree, Breadth-First Search, Binary Tree | Medium | 39 | 0.7% |
| 142 | Word Search II Array, String, Backtracking, Trie, Matrix | Hard | 39 | 0.4% |
| 143 | Kth Largest Sum in a Binary Tree Tree, Breadth-First Search, Sorting, Binary Tree | Medium | 39 | 0.6% |
| 144 | Longest Non-decreasing Subarray From Two Arrays Array, Dynamic Programming | Medium | 39 | 0.3% |
| 145 | Search in Rotated Sorted Array Array, Binary Search | Medium | 39 | 0.5% |
| 146 | Count Ways To Build Good Strings Dynamic Programming | Medium | 39 | 0.6% |
How to read this list
The tabs at the top split the questions by how recently people said they were asked in interviews. "Last 30 Days" is the past month, "Last 3 Months" is the past quarter, and so on. "All Time" is every question on record for this company.
Frequency is a score from 0 to 100 for how often a question showed up in that time window. A higher number means it came up more often, so the list starts with the most common questions first. Acceptance is the share of submissions that pass on LeetCode. Click any question to open it on LeetCode.