Skip to content

WindomZ/leetcode.go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode.go

My solutions(Golang) of problems in https://leetcode.com/

Build Status Coverage Status Go Report Card FOSSA Status

Pursue

  • Faster and Better solutions.
  • 100% coverage tests.
  • 100% benchmark tests.

Catalog

Support

If you like it then you can put a ⭐Star on it.

Solutions

'Single Repetition Duration' and 'LeetCode Run Time' are for reference only.

# Problem & Solution Difficulty Single Repetition Duration LeetCode Run Time
108 Convert Sorted Array to Binary Search Tree Easy 138 ns/op / 5 test cases 204 ms
107 Binary Tree Level Order Traversal II Easy 102 ns/op / 3 test cases 8 ms
106 Construct Binary Tree from Inorder and Postorder Traversal Medium 60.0 ns/op / 3 test cases 32 ms
105 Construct Binary Tree from Preorder and Inorder Traversal Medium 60.0 ns/op / 3 test cases 36 ms
104 Maximum Depth of Binary Tree Easy 18.7 ns/op / 5 test cases 8 ms
103 Binary Tree Zigzag Level Order Traversal Medium 78.6 ns/op / 3 test cases 0 ms
102 Binary Tree Level Order Traversal Medium 76.0 ns/op / 3 test cases 8 ms
101 Symmetric Tree Easy 17.6 ns/op / 5 test cases 4 ms
100 Same Tree Easy 9.12 ns/op / 6 test cases 0 ms
99 Recover Binary Search Tree Hard 94.8 ns/op / 3 test cases 32 ms
98 Validate Binary Search Tree Medium 21.0 ns/op / 8 test cases 8 ms
96 Unique Binary Search Trees Medium 39.1 ns/op / 6 test cases 0 ms
95 Unique Binary Search Trees II Medium 259 ns/op / 3 test cases 48 ms
94 Binary Tree Inorder Traversal Medium 119 ns/op / 3 test cases 0 ms
93 Restore IP Addresses Medium 251 ns/op / 4 test cases 4 ms
92 Reverse Linked List II Medium 61.5 ns/op / 3 test cases 3 ms
91 Decode Ways Medium 68.3 ns/op / 8 test cases 3 ms
90 Subsets II Medium 326 ns/op / 5 test cases 9 ms
89 Gray Code Medium 88.6 ns/op / 6 test cases 9 ms
88 Merge Sorted Array Easy 9.00 ns/op / 6 test cases 3 ms
86 Partition List Medium 89.1 ns/op / 3 test cases 3 ms
83 Remove Duplicates from Sorted List Easy 93.0 ns/op / 6 test cases 9 ms
82 Remove Duplicates from Sorted List II Medium 9.62 ns/op / 6 test cases 6 ms
81 Search in Rotated Sorted Array II Medium 11.7 ns/op / 12 test cases 9 ms
80 Remove Duplicates from Sorted Array II Medium 9.82 ns/op / 6 test cases 12 ms
79 Word Search Medium 73.3 ns/op / 6 test cases 6 ms
78 Subsets Medium 447 ns/op / 5 test cases 6 ms
77 Combinations Medium 336 ns/op / 6 test cases 246 ms
75 Sort Colors Medium 13.4 ns/op / 6 test cases 3 ms
74 Search a 2D Matrix Medium 32.5 ns/op / 6 test cases 16 ms
73 Set Matrix Zeroes Medium 22.0 ns/op / 6 test cases 42 ms
71 Simplify Path Medium 382 ns/op / 6 test cases 3 ms
70 Climbing Stairs Easy 7.59 ns/op / 9 test cases 0 ms
69 Sqrt(x) Easy 27.6 ns/op / 8 test cases 6 ms
67 Add Binary Easy 84.0 ns/op / 5 test cases 3 ms
66 Plus One Easy 29.8 ns/op / 6 test cases 3 ms
65 Valid Number Hard 46.3 ns/op / 8 test cases 9 ms
64 Minimum Path Sum Medium 48.4 ns/op / 5 test cases 16 ms
63 Unique Paths II Medium 36.3 ns/op / 5 test cases 3 ms
62 Unique Paths Medium 5.51 ns/op / 11 test cases 0 ms
61 Rotate List Medium 34.0 ns/op / 2 test cases 6 ms
60 Permutation Sequence Medium 73.9 ns/op / 6 test cases 3 ms
59 Spiral Matrix II Medium 82.1 ns/op / 3 test cases 0 ms
58 Length of Last Word Easy 4.02 ns/op / 5 test cases 0 ms
56 Merge Intervals Medium 154 ns/op / 5 test cases 19 ms
55 Jump Game Medium 7.32 ns/op / 6 test cases 19 ms
54 Spiral Matrix Medium 45.5 ns/op / 3 test cases 0 ms
53 Maximum Subarray Easy 10.3 ns/op / 6 test cases 12 ms
50 Pow(x, n) Medium 7.31 ns/op / 12 test cases 3 ms
49 Group Anagrams Medium 313 ns/op / 3 test cases 582 ms
48 Rotate Image Medium 12.1 ns/op / 3 test cases 3 ms
47 Permutations II Medium 198 ns/op / 3 test cases 19 ms
46 Permutations Medium 484 ns/op / 3 test cases 9 ms
45 Jump Game II Hard 5.14 ns/op / 6 test cases 19 ms
44 Wildcard Matching Hard 10.9 ns/op / 9 test cases 15 ms
43 Multiply Strings Medium 53.4 ns/op / 6 test cases 3 ms
42 Trapping Rain Water Hard 14.4 ns/op / 6 test cases 6 ms
41 First Missing Positive Hard 12.3 ns/op / 6 test cases 3 ms
40 Combination Sum II Medium 203 ns/op / 3 test cases 3 ms
39 Combination Sum Medium 165 ns/op / 3 test cases 6 ms
38 Count and Say Easy 66.8 ns/op / 4 test cases 0 ms
37 Sudoku Solver Hard 35497 ns/op / 2 test cases 0 ms
36 Valid Sudoku Medium 135 ns/op / 3 test cases 6 ms
35 Search Insert Position Easy 7.76 ns/op / 8 test cases 6 ms
34 Search for a Range Medium 53.5 ns/op / 8 test cases 19 ms
33 Search in Rotated Sorted Array Medium 30.0 ns/op / 8 test cases 3 ms
32 Longest Valid Parentheses Hard 78.9 ns/op / 8 test cases 3 ms
31 Next Permutation Medium 2.97 ns/op / 4 test cases 6 ms
30 Substring with Concatenation of All Words Hard 331 ns/op / 3 test cases 13 ms
29 Divide Two Integers Medium 63.2 ns/op / 12 test cases 6 ms
28 Implement strStr() Easy 9.29 ns/op / 7 test cases 0 ms
27 Remove Element Easy 8.75 ns/op / 6 test cases 3 ms
26 Remove Duplicates from Sorted Array Easy 9.51 ns/op / 6 test cases 102 ms
25 Reverse Nodes in k-Group Hard 58.6 ns/op / 3 test cases 9 ms
24 Swap Nodes in Pairs Medium 62.1 ns/op / 4 test cases 0 ms
23 Merge k Sorted Lists Hard 88.7 ns/op / 4 test cases 19 ms
22 Generate Parentheses Medium 340 ns/op / 4 test cases 13 ms
21 Merge Two Sorted Lists Easy 89.0 ns/op / 3 test cases 3 ms
20 Valid Parentheses Easy 28.9 ns/op / 6 test cases 0 ms
19 Remove Nth Node From End of List Medium 97.3 ns/op / 6 test cases 3 ms
18 4Sum Medium 233 ns/op / 3 test cases 16 ms
17 Letter Combinations of a Phone Number Medium 407 ns/op / 4 test cases 0 ms
16 3Sum Closest Medium 379 ns/op / 8 test cases 9 ms
15 3Sum Medium 183 ns/op / 4 test cases 1525 ms
14 Longest Common Prefix Easy 10.6 ns/op / 8 test cases 3 ms
13 Roman to Integer Easy 16.9 ns/op / 8 test cases 19 ms
12 Integer to Roman Medium 26.4 ns/op / 8 test cases 22 ms
11 Container With Most Water Medium 7.84 ns/op / 5 test cases 25 ms
10 Regular Expression Matching Hard 183 ns/op / 6 test cases 3 ms
9 Palindrome Number Easy 6.37 ns/op / 7 test cases 55 ms
8 String to Integer (atoi) Medium 7.31 ns/op / 5 test cases 3 ms
7 Reverse Integer Easy 9.00 ns/op / 5 test cases 3 ms
6 ZigZag Conversion Medium 55.1 ns/op / 5 test cases 9 ms
5 Longest Palindromic Substring Medium 39.1 ns/op / 6 test cases 9 ms
4 Median of Two Sorted Arrays Hard 19.4 ns/op / 14 test cases 32 ms
3 Longest Substring Without Repeating Characters Medium 21.3 ns/op / 3 test cases 6 ms
2 Add Two Numbers Medium 19.4 ns/op / 1 test cases 29 ms
1 Two Sum Easy 79.5 ns/op / 3 test cases 6 ms

All tests should be run on a same machine, and through multiple benchmark tests.

Testing

git clone https://github.com/WindomZ/leetcode.go.git "$YOUR_PROJECT_PATH"
cd "$YOUR_PROJECT_PATH"
go test -v -run=. ./solutions/...
go test -bench=. -benchmem ./solutions/...

Related

Helper

Contributing

Challenge

Welcome to pull requests(PRs) of the better solutions.

  1. Pass all LeetCode test cases.
  2. Pass all my test cases.
  3. Faster than mine! (on a machine, and run benchmark tests repeatedly)

Discuss

Welcome to report bugs, suggest ideas and discuss on issues page.

License

FOSSA Status