LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.
Our top interview questions are divided into levels of difficulty of problems like Easy, Medium, and Hard to help you master Data Structure & Algorithms and improve your coding skills.
List of LeetCode solutions along with related topics. Solutions in different programming languages like C++, Java, JavaScript, and Python.

# | Problem Title | Solution |
---|---|---|
1 | Two Sum | Solution |
2 | Add Two Numbers | Solution |
3 | Longest Substring Without Repeating Characters | Solution |
4 | Median of Two Sorted Arrays | Solution |
5 | Longest Palindromic Substring | Solution |
6 | Zigzag Conversion | Solution |
10 | Regular Expression Matching | Solution |
15 | 3Sum | Solution |
20 | Valid Parentheses | Solution |
21 | Merge Two Sorted Lists | Solution |
23 | Merge k Sorted Lists | Solution |
24 | Swap Nodes in Pairs | Solution |
25 | Reverse Nodes in k-Group | Solution |
# | Problem Title | Solution |
---|---|---|
26 | Remove Duplicates from Sorted Array | Solution |
27 | Remove Element | Solution |
28 | Find the Index of the First Occurrence in a String | Solution |
29 | Divide Two Integers | Solution |
30 | Substring with Concatenation of All Words | Solution |
32 | Longest Valid Parentheses | Solution |
33 | Search in Rotated Sorted Array | Solution |
35 | Search Insert Position | Solution |
37 | Sudoku Solver | Solution |
39 | Combination Sum | Solution |
40 | Combination Sum II | Solution |
41 | First Missing Positive | Solution |
42 | Trapping Rain Water | Solution |
43 | Multiply Strings | Solution |
44 | Wildcard Matching | Solution |
46 | Permutations | Solution |
47 | Permutations II | Solution |
48 | Rotate Image | Solution |
49 | Group Anagrams | Solution |
50 | Pow(x, n) | Solution |
# | Problem Title | Solution |
---|---|---|
68 | Text Justification | Solution |
70 | Climbing Stairs | Solution |
84 | Largest Rectangle in Histogram | Solution |
109 | Convert Sorted List to Binary Search Tree | Solution |
122 | Best Time to Buy and Sell Stock II | Solution |
136 | Single Number | Solution |
160 | Intersection of Two Linked Lists | Solution |
169 | Majority Element | Solution |
190 | Reverse Bits | Solution |
198 | House Robber | Solution |
202 | Happy Number | Solution |
206 | Reverse Linked List | Solution |
212 | Word Search II | Solution |
217 | Contains Duplicate | Solution |
219 | Contains Duplicate II | Solution |
220 | Contains Duplicate III | Solution |
221 | Maximal Square | Solution |
227 | Basic Calculator II | Solution |
237 | Delete Node in a Linked List | Solution |
258 | Add Digits | Solution |
292 | Nim Game | Solution |
Add Digits LeetCode Solution
Given an integer num, repeatedly add all its digits until the result has only one digit,…
Single Number LeetCode Solution
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one.
Majority Element LeetCode Solution
Given an array nums of size n, return the majority element. The majority element is…
Median of Two Sorted Arrays LeetCode Solution
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time…
Regular Expression Matching LeetCode Solution
Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where ‘.’ Matches any…
Reverse Nodes in k-Group LeetCode Solution
Given the head of a linked list, reverse the nodes of the list k at…