Skip to content

alexsmaliy/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

What This Is

This repo is a collection of Java solutions to some LeetCode problems, with a bit of discussion included with each.

I formatted the code to run conveniently in my IDE. You may need to fiddle with static modifiers on classes and methods if you want to paste code into the LeetCode UI verbatim.

The argument types and return types of the functions the LeetCode grader expects to call have been kept the same. Where alternative solutions are offered, the function names have been changed to distinguish them.

The common data types that LeetCode requires users to use have been factored out into a separate package. I have only modified these classes to add convenience methods, like toString(), to make solutions more easily testable.

Table of Contents

LeetCode ID Discussion
LC 1 Two Sum
LC 2 Add Two Numbers
LC 3 Longest Substring Without Repeating Characters
LC 15 3Sum
LC 19 Remove Nth Node from End of List
LC 20 Valid Parentheses
LC 23 Merge k Sorted Lists
LC 26 Remove Duplicates from Sorted Array
LC 39 Combination Sum
LC 40 Combination Sum II
LC 49 Group Anagrams
LC 53 Maximum Subarray
LC 55 Jump Game
LC 56 Merge Intervals
LC 62 Unique Paths
LC 70 Climbing Stairs
LC 72 Edit Distance
LC 76 Minimum Window Substring
LC 91 Decode Ways
LC 98 Validate Binary Search Tree
LC 100 Same Tree
LC 102 Binary Tree Level Order Traversal
LC 104 Maximum Depth of Binary Tree
LC 121 Best Time to Buy and Sell Stock
LC 133 Clone Graph
LC 139 Word Break
LC 140 Word Break II
LC 141 Linked List Cycle
LC 142 Linked List Cycle II
LC 153 Find Minimum in Rotated Sorted Array
LC 198 House Robber
LC 200 Number of Islands
LC 206 Reverse Linked List
LC 207 Course Schedule
LC 208 Implement Trie (Prefix Tree)
LC 212 Word Search II
LC 213 House Robber II
LC 216 Combination Sum III
LC 217 Contains Duplicate
LC 219 Contains Duplicate II
LC 226 Invert Binary Tree
LC 230 kth Smallest Element in a BST
LC 238 Product of Array Except Self
LC 242 Valid Anagram
LC 297 Serialize and Deserialize Binary Tree
LC 300 Longest Increasing Subsequence
LC 322 Coin Change
LC 328 Odd Even Linked List
LC 377 Combination Sum IV
LC 417 Pacific Atlantic Water Flow
LC 424 Longest Repeating Character Replacement
LC 435 Non-Overlapping Intervals
LC 442 Find All Duplicates in an Array
LC 572 Subtree of Another Tree
LC 725 Split Linked List in Parts
LC 1047 Remove All Adjacent Duplicates in String
LC 1209 Remove All Adjacent Duplicates in String II

About

Everybody does it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages