Skip to content

My solutions with unit tests for problems on LeetCode

License

Notifications You must be signed in to change notification settings

tqa236/leetcode-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solved problems

ID Name Runtime (ms) Runtime (Better than) (%) Memory Usage (MB) Memory Usage (Better than) (%)
1 Two Sum 104 30.35 15.1 69.92
2 Add Two Numbers 72 53.37 14.2 73.98
3 Longest Substring Without Repeating Characters 36 99.96 14.2 83.04
4 Median of Two Sorted Arrays 96 74.34 13.9 85.35
7 Reverse Integer 32 70.20 13.8 75.27
9 Palindrome Number 55 78.41 16.1 95.5
11 Container With Most Water 168 75.03 16.6 50.30
15 3Sum 1676 24.00 153.5 N/A
18 4Sum 64 99.28 14.4 59.84
20 Valid Parentheses 28 85.27 14.3 66.87
24 Swap Nodes in Pairs 28 82.02 14.2 58.00
31 Next Permutation 40 80.88 13.9 41.92
56 Merge Intervals 88 49.72 16.3 9.35
57 Insert Interval 84 71.85 17.1 75.36
58 Length of Last Word 44 17.34 13.9 45.34
88 Merge Sorted Array 36 69.59 14.3 N/A
94 Binary Tree Inorder Traversal 32 55.77 13.7 93.01
104 Maximum Depth of Binary Tree 44 41.51 16.2 31.93
110 Balanced Binary Tree 48 80.34 18.0 66.91
117 Populating Next Right Pointers in Each Node II 52 36.67 15.5 N/A
121 Best Time to Buy and Sell Stock 68 58.99 15.1 51.98
125 Valid Palindrome 54 38.77 22.58 5.85
127 Word Ladder 552 21.13 15.2 78.78
138 Copy List with Random Pointer 32 87.70 15.2 20.09
179 Largest Number 36 84.93 14.1 7.32
198 House Robber 40 27.94 13.8 59.98
205 Isomorphic Strings 36 88.24 14.1 47.13
215 Kth Largest Element in an Array 60 88.90 15.1 74.25
229 Majority Element II 128 32.86 13.8 45.86
231 Power of Two 60 6.30 14.2 38.92
242 Valid Anagram 32 98.22 14.5 78.18
264 Ugly Number II 7500 N/A 12.8 58.04
284 Peeking Iterator 36 35.04 14.4 66.46
326 Power of Three 84 45.19 14.1 77.17
334 Increasing Triplet Subsequence 48 92.00 14.7 43.86
342 Power of Four 56 5.66 14.1 89.11
344 Reverse String 172 38.96 20.85 69.97
376 Wiggle Subsequence 36 62.24 14.1 89.37
389 Find the Difference 20 99.43 14.1 N/A
413 Arithmetic Slices 40 48.59 14.5 76.96
421 Maximum XOR of Two Numbers in an Array 421 66.31 16.3 97.66
495 Teemo Attacking 256 95.94 15.3 7.16
498 Diagonal Traverse 188 80.36 16.8 51.85
526 Beautiful Arrangement 56 95.48 15.1 16.88
557 Reverse Words in a String III 36 64.78 14.2 76.21
564 Find the Closest Palindrome 32 58.28 14.5 8.61
581 Shortest Unsorted Continuous Subarray 212 59.02 15.6 N/A
605 Can Place Flowers 164 57.77 14.6 66.37
628 Maximum Product of Three Numbers 244 94.03 15.6 7.12
693 Binary Number with Alternating Bits 32 55.19 13.7 78.74
709 To Lower Case 24 92.04 14.1 86.65
713 Subarray Product Less Than K 1616 18.97 18.4 N/A
714 Subarray Product Less Than K 1616 18.97 18.4 N/A
717 Best Time to Buy and Sell Stock with Transaction Fee 580 99.55 21.1 99.37
775 Global and Local Inversions 348 35.46 15.2 13.15
780 Reaching Points 32 55.25 14.3 28.62
792 Number of Matching Subsequences 2216 16.76 15.1 58.71
811 Subdomain Visit Count 64 29.36 14.2 5.12
886 Possible Bipartition 648 100.00 18.8 70.16
890 Find and Replace Pattern 36 35.82 14.3 30.80
898 Bitwise ORs of Subarrays 1396 10.12 40.2 57.52
917 Reverse Only Letters 32 57.92 13.7 82.00
933 Number of Recent Calls 608 12.50 18.0 7.50
977 Squares of a Sorted Array 240 66.45 15.7 64.88
986 Interval List Intersections 152 51.51 14.9 78.81
1002 Find Common Characters 44 82.93 16.62 67.21
1041 Robot Bounded In Circle 36 33.56 14.1 N/A
1091 Shortest Path in Binary Matrix 1524 5.01 16.3 6.80
1094 Car Pooling 72 44.68 14.5 12.59
1247 Minimum Swaps to Make Strings Equal 12 100.00 13.8 52.77
1275 Find Winner on a Tic Tac Toe Game 40 28.62 13.8 72.16
1281 Subtract the Product and Sum of Digits of an Integer 32 49.10 14.3 30.56
1291 Sequential Digits 40 22.56 13.8 50.26
1328 Break a Palindrome 28 77.26 14.0 18.31
1345 Jump Game IV 496 81.90 30.4 37.72
1450 Number of Students Doing Homework at a Given Time 36 72.00 14.4 19.36
1463 Cherry Pickup II 1608 33.01 26.7 52.15
1641 Count Sorted Vowel Strings 40 30.41 14.3 57.36
1646 Get Maximum in Generated Array 24 95.87 14.4 N/A
1658 Minimum Operations to Reduce X to Zero 1216 66.20 28.8 63.39
1662 Check If Two String Arrays are Equivalent 40 19.73 14.2 86.98
1679 Max Number of K-Sum Pairs 848 18.68 27.5 40.53

Docker command

Build image:

docker build --tag leetcode .

Run container:

docker run -it -p 8888:8888 -v "$(pwd):/leetcode" leetcode /bin/bash

TODO

  • Configure CI
  • Configure Code Analysis
  • Configure CodeCov
  • TODO: 5, 887, 446, 322, 152

About

My solutions with unit tests for problems on LeetCode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages