The C++ solutions for LeetCode problems.
# | Title | Solutions | Time | Space | Comments |
---|---|---|---|---|---|
1 | Two Sum | C++(16ms) | O(N) | O(N) | |
2 | Add Two Numbers | C++(36ms) | O(Max(N, M)) | O(1) | |
3 | Longest Substring Without Repeating Characters | C++(12ms) | O(N) | O(1) | C# use array will slower |
4 | Median of Two Sorted Arrays | C++(40ms) | O(Log(N+M)) | O(1) | |
5 | Longest Palindromic Substring | C++(4ms) | O(N) | O(N) | Use Manacher's Algorithm |
6 | ZigZag Conversion | C++(16ms) | O(N) | O(N) | |
7 | Reverse Integer | C++(8ms) | O(1) | O(1) | |
8 | String to Integer (atoi) | C++(8ms) | O(1) | O(1) |