LeetCode Solutions

You can find the answer to LeetCode's questions that are group by difficulty, company, and topic in this repo.

All codes are written by c#. Please don't hesitate to create an issue, if you see a mistake, wrong solution/information.

As you can see below lists, there are a lot of questions. You can choose one of them and contribute it :)

Questions

  • Two Sum
  • Longest Substring Without Repeating Characters
  • String to Integer (atoi)
  • Container With Most Water
  • Integer to Roman
  • Roman to Integer
  • 3Sum
  • 3Sum Closest
  • Implement strStr()
  • Rotate Image
  • Group Anagrams
  • Minimum Window Substring
  • Compare Version Numbers
  • Product of Array Except Self
  • Missing Number
  • Integer to English Words
  • First Unique Character in a String
  • Valid Parentheses
  • Most Common Word
  • Reorder Log Files
  • Remove Duplicates from Sorted Array
  • Best Time to Buy and Sell Stock II
  • Rotate Array
  • Contains Duplicate
  • Single Number
  • Intersection of Two Arrays II
  • Plus One
  • Move Zeroes
  • Two Sum
  • Valid Sudoku
  • Rotate Image
  • 3Sum
  • Set Matrix Zeroes
  • Increasing Triplet Subsequence
  • Missing Ranges
  • Spiral Matrix
  • 4Sum II
  • Game of Life
  • First Missing Positive
  • Longest Consecutive Sequence
  • Find the Duplicate Number
  • Longest Substring with At Most K Distinct Characters
  • Basic Calculator II
  • Sliding Window Maximum

Backtracking

  • Permutations
  • Subsets
  • Palindrome Partitioning
  • Remove Invalid Parentheses
  • Wildcard Matching
  • Regular Expression Matching

Design

  • LRU Cache
  • Min Stack
  • Find Median from Data Stream
  • Serialize and Deserialize Binary Tree
  • Design Tic-Tac-Toe
  • Design Search Autocomplete System
  • Maximum Frequency Stack
  • Shuffle an Array
  • Min Stack
  • Flatten 2D Vector
  • Insert Delete GetRandom O(1)
  • Implement Trie (Prefix Tree)
  • Flatten Nested List Iterator
  • Range Sum Query 2D - Mutable
  • Longest Palindromic Substring
  • Maximum Subarray
  • Best Time to Buy and Sell Stock
  • Word Break
  • Coin Change
  • Climbing Stairs
  • Best Time to Buy and Sell Stock
  • Maximum Subarray
  • House Robber
  • Jump Game
  • Unique Paths
  • Longest Increasing Subsequence
  • Maximum Product Subarray
  • Decode Ways
  • Best Time to Buy and Sell Stock with Cooldown
  • Perfect Squares
  • Word Break II
  • Burst Balloons
  • Add Two Numbers
  • Merge Two Sorted Lists
  • Reverse Nodes in k-Group
  • Copy List with Random Pointer
  • Reverse Linked List
  • Merge k Sorted Lists
  • Delete Node in a Linked List
  • Remove Nth Node From End of List
  • Reverse Linked List
  • Merge Two Sorted Lists
  • Palindrome Linked List
  • Linked List Cycle
  • Odd Even Linked List
  • Intersection of Two Linked Lists
  • Sort List

Math

  • Fizz Buzz
  • Count Primes
  • Power of Three
  • Roman to Integer
  • Happy Number
  • Factorial Trailing Zeroes
  • Excel Sheet Column Number
  • Pow(x, n)
  • Sqrt(x)
  • Divide Two Integers
  • Fraction to Recurring Decimal
  • Largest Number
  • Max Points on a Line

Others

  • Reverse Integer
  • Second Highest Salary
  • Partition Labels
  • Prison Cells After N Days
  • Number of 1 Bits
  • Hamming Distance
  • Reverse Bits
  • Pascal's Triangle
  • Valid Parentheses
  • Missing Number
  • Sum of Two Integers
  • Evaluate Reverse Polish Notation
  • Majority Element
  • Find the Celebrity
  • Task Scheduler
  • Queue Reconstruction by Height
  • The Skyline Problem
  • Largest Rectangle in Histogram

Recursion

Sorting and Searching

  • Median of Two Sorted Arrays
  • Search in Rotated Sorted Array
  • Merge Intervals
  • Two Sum II - Input array is sorted
  • Kth Largest Element in an Array
  • Meeting Rooms II
  • Top K Frequent Elements
  • K Closest Points to Origin
  • Merge Sorted Array
  • First Bad Version
  • Sort Colors
  • Find Peak Element
  • Search for a Range
  • Search a 2D Matrix II
  • Wiggle Sort II
  • Kth Smallest Element in a Sorted Matrix

Strings

  • Reverse String
  • Reverse Integer
  • First Unique Character in a String
  • Valid Anagram
  • Valid Palindrome
  • String to Integer (atoi)
  • Implement strStr()
  • Count and Say
  • Longest Common Prefix

Trees

  • Maximum Depth of Binary Tree
  • Validate Binary Search Tree
  • Symmetric Tree
  • Binary Tree Level Order Traversal
  • Convert Sorted Array to Binary Search Tree

Trees and Graphs

  • Validate Binary Search Tree
  • Symmetric Tree
  • Binary Tree Level Order Traversal
  • Binary Tree Zigzag Level Order Traversal
  • Binary Tree Maximum Path Sum
  • Word Ladder II
  • Word Ladder
  • Number of Islands
  • Course Schedule
  • Lowest Common Ancestor of a Binary Tree
  • Diameter of Binary Tree
  • Cut Off Trees for Golf Event
  • Flood Fill
  • Binary Tree Inorder Traversal
  • Binary Tree Zigzag Level Order Traversal
  • Construct Binary Tree from Preorder and Inorder Traversal
  • Populating Next Right Pointers in Each Node
  • Kth Smallest Element in a BST
  • Inorder Successor in BST
  • Surrounded Regions
  • Friend Circles
  • Course Schedule II
  • Longest Increasing Path in a Matrix
  • Alien Dictionary
  • Count of Smaller Numbers After Self