
The Java solutions for LeetCode problems.
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 1 |
Two Sum |
Java(324ms) |
O(N) |
O(N) |
|
| 2 |
Add Two Numbers |
Java(428ms) |
O(Max(N, M)) |
O(1) |
|
| 3 |
Longest Substring Without Repeating Characters |
Java(368ms) |
O(N) |
O(1) |
C# use array will slower |
| 4 |
Median of Two Sorted Arrays |
Java(596ms) |
O(Log(N+M)) |
O(1) |
|
| 5 |
Longest Palindromic Substring |
Java(316ms) |
O(N) |
O(N) |
Use Manacher's Algorithm |
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 222 |
Count Complete Tree Nodes |
Java(0ms) |
O(log2N) |
O(1) |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 287 |
Find the Duplicate Number |
Java(1ms) |
O(N) |
O(1) |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 410 |
Split Array Largest Sum |
Java(1ms) |
O(N∗log(sum of array)) |
O(1) |
Binary Search |
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 482 |
License Key Formatting |
Java(14ms) |
O(N) |
O(N) |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 843 |
Guess the Word |
Java(1ms) |
O(N2) |
O(N) |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 1007 |
Minimum Domino Rotations For Equal Row |
Java(4ms) |
O(N) |
O(1) |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 1057 |
Campus Bikes |
Java(49ms) |
O(N*M) |
O(N*M) |
|
| 1096 |
Brace Expansion II |
Java(44ms) |
O(N) |
? |
|
Back to Table of Contents
| # |
Title |
Solutions |
Time |
Space |
Comments |
| 1197 |
Minimum Knight Moves |
Java(2ms) |
O(N2) |
O(N2) |
|