Skip to content

mutoe/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

318 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Leetcode solution

GitHub Workflow Status Codecov

Thanks for leetcode editor provide convenient learning tools.

Solutions

ID Title Time Space Ranking
1 two sum 4ms O(n) O(n) 95.58% 🟒
2 add two numbers 12ms O(n) O(n) 64.05% 🟠
3 longest substring without repeating characters 584ms O(n^2) O(n) 5.03% πŸ”΄
6 zigzag conversion 8ms O(n) O(n) 74.58% 🟠
7 reverse integer 0ms O(log(n)) O(1) 100% 🟒
8 string to integer atoi 4ms O(n) O(1) 47.51% πŸ”΄
11 container with most water 296ms O(n^2) O(1) 26.72% πŸ”΄
12 integer to roman 12ms O(log(n)) O(1) 44.82% πŸ”΄
20 valid parentheses 0ms O(n) O(n) 100% 🟒
21 merge two sorted lists 0ms O(n) O(1) 100% 🟒
35 search insert position 0ms O(log(n)) O(1) 100% 🟒
69 sqrtx 8ms O(log(n)) O(1) 19.58% πŸ”΄
75 sort colors 0ms O(n) O(1) 100% 🟒
83 remove duplicates from sorted list 0ms O(n) O(1) 100% 🟒
100 same tree 0ms O(n) O(1) 100% 🟒
101 symmetric tree 0ms O(n) O(1) 100% 🟒
102 binary tree level order traversal 0ms O(n) O(n) 100% 🟒
104 maximum depth of binary tree 4ms O(n) O(1) 90.15% 🟒
107 binary tree level order traversal ii 0ms O(n) O(n) 100% 🟒
108 convert sorted array to binary search tree 108ms O(n) O(n) 62.9% 🟠
110 balanced binary tree 4ms O(n) O(n) 96.71% 🟒
111 minimum depth of binary tree 228ms O(n) O(n) 85.67% 🟠
112 path sum 4ms O(n) O(1) 96.52% 🟒
119 pascals triangle ii 1ms O(n^2) O(n^2) 59.83% 🟠
122 best time to buy and sell stock ii 4ms O(n) O(1) 94.38% 🟒
125 valid palindrome 0ms O(n*log(n)) O(1) 100% 🟒
141 linked list cycle 4ms O(n) O(1) 96% 🟒
155 min stack 12ms O(n) O(n) 98.73% 🟒
160 intersection of two linked lists 44ms O(n) O(n) 30.1% πŸ”΄
167 two sum ii input array is sorted 4ms O(n*log(n)) O(1) 94.87% 🟒
168 excel sheet column title 0ms O(log(n)) O(1) 100% 🟒
171 excel sheet column number 0ms O(n) O(1) 100% 🟒
182 duplicate emails 343ms unknown unknown 42.48% πŸ”΄
193 valid phone numbers 0ms O(n) O(1) 100% 🟒
195 tenth line 0ms O(1) O(1) 100% 🟒
200 number of islands 0ms O(n*m) O(n) 100% 🟒
201 bitwise and of numbers range 626ms O(n) O(1) 6.25% πŸ”΄
202 happy number 0ms O(1) O(1) 100% 🟒
203 remove linked list elements 8ms O(n) O(1) 88.89% 🟠
204 count primes 8ms O(n) O(n) 81.42% 🟠
206 reverse linked list 0ms O(n) O(1) 100% 🟒
208 implement trie prefix tree 72ms O(n) O(n) 50.75% 🟠
211 design add and search words data structure 96ms O(n) O(n) 38.61% πŸ”΄
212 word search ii 1432ms unknown O(n) 26.06% πŸ”΄
215 kth largest element in an array 4ms O(n*log(n)) O(1) 98.66% 🟒
219 contains duplicate ii 250ms O(n) O(n) 37.93% πŸ”΄
225 implement stack using queues 0ms O(n) O(n) 100% 🟒
226 invert binary tree 0ms O(n) O(1) 100% 🟒
231 power of two 0ms O(log(n)) O(1) 100% 🟒
232 implement queue using stacks 0ms O(n) O(1) 100% 🟒
235 lowest common ancestor of a binary search tree 20ms O(n) O(1) 80.11% 🟠
237 delete node in a linked list 0ms O(1) O(1) 100% 🟒
242 valid anagram 0ms O(n) O(1) 100% 🟒
258 add digits 0ms O(1) O(1) 100% 🟒
263 ugly number 0ms O(log(n)) O(1) 100% 🟒
278 first bad version 0ms O(log(n)) O(1) 100% 🟒
283 move zeroes 12ms O(n*log(n)) O(1) 6.22% πŸ”΄
303 range sum query immutable 24ms O(n) O(n) 98.41% 🟒
326 power of three 8ms O(1) O(1) 99.32% 🟒
345 reverse vowels of a string 0ms O(n*log(n)) O(n) 100% 🟒
347 top k frequent elements 12ms O(n) O(n) 87.27% 🟠
349 intersection of two arrays 0ms O(n) O(n) 100% 🟒
350 intersection of two arrays ii 4ms O(n) O(n) 79.29% 🟠
367 valid perfect square 0ms O(log(n)) O(1) 100% 🟒
374 guess number higher or lower 0ms O(log(n)) O(1) 100% 🟒
387 first unique character in a string 4ms O(n) O(1) 97.53% 🟒
392 is subsequence 0ms O(n) O(1) 100% 🟒
404 sum of left leaves 0ms O(n) O(1) 100% 🟒
415 add strings 0ms O(n) O(n) 100% 🟒
441 arranging coins 8ms O(n) O(1) 38.46% πŸ”΄
468 validate ip address 0ms O(1) O(1) 100% 🟒
496 next greater element i 0ms O(n^2) O(n) 100% 🟒
501 find mode in binary search tree 12ms O(n) O(n) 51.16% 🟠
506 relative ranks 12ms O(n*log(n)) O(log(n)) 93.94% 🟒
507 perfect number 0ms O(log(n)) O(1) 100% 🟒
530 minimum absolute difference in bst 12ms O(n) O(1) 72.92% 🟠
563 binary tree tilt 8ms O(n) O(1) 94.08% 🟒
572 subtree of another tree 20ms O(n^2) O(1) 47.97% πŸ”΄
617 merge two binary trees 28ms O(n) O(n) 87.26% 🟠
628 maximum product of three numbers 28ms O(n) O(1) 100% 🟒
637 average of levels in binary tree 8ms O(n) O(n) 89.47% 🟠
658 find k closest elements 123ms O(n*log(n)) O(n) 6.82% πŸ”΄
677 map sum pairs 0ms O(n) O(n) 100% 🟒
682 baseball game 0ms O(n) O(n) 100% 🟒
690 employee importance 12ms O(n) O(n) 100% 🟒
700 search in a binary search tree 24ms O(n) O(1) 84.67% 🟠
703 kth largest element in a stream 32ms O(n*log(n)) O(n) 78.22% 🟠
704 binary search 36ms O(log(n)) O(1) 67.19% 🟠
724 find pivot index 12ms O(n) O(n) 100% 🟒
733 flood fill 4ms O(n^2) O(n) 99.07% 🟒
744 find smallest letter greater than target 0ms O(log(n)) O(1) 100% 🟒
786 k th smallest prime fraction 486ms O(n^2) O(n) 50% 🟠
844 backspace string compare 0ms O(n) O(1) 100% 🟒
852 peak index in a mountain array 0ms O(log(n)) O(1) 100% 🟒
875 koko eating bananas 48ms O(n*log(n)) O(1) 55.77% 🟠
876 middle of the linked list 0ms O(n) O(1) 100% 🟒
922 sort array by parity ii 16ms O(n) O(1) 98.46% 🟒
925 long pressed name 0ms O(n) O(1) 100% 🟒
933 number of recent calls 128ms O(n) O(n) 79.37% 🟠
976 largest perimeter triangle 24ms O(n*log(n)) O(1) 100% 🟒
989 add to array form of integer 24ms O(n) O(1) 100% 🟒
1011 capacity to ship packages within d days 40ms O(n*log(n)) O(1) 41.46% πŸ”΄
1021 remove outermost parentheses 0ms O(n) O(n) 100% 🟒
1030 matrix cells in distance order 36ms O(n^2) O(n^2) 15.38% πŸ”΄
1046 last stone weight 0ms O(n) O(n) 100% 🟒
1047 remove all adjacent duplicates in string 4ms O(n) O(n) 87.67% 🟠
1122 relative sort array 0ms O(n^2) O(n) 100% 🟒
1147 longest chunked palindrome decomposition 0ms O(n) O(n) 100% 🟒
1290 convert binary number in a linked list to integer 0ms O(n) O(1) 100% 🟒
1323 maximum 69 number 0ms O(n) O(1) 100% 🟒
1337 the k weakest rows in a matrix 12ms O(n*m) O(n) 82.89% 🟠
1346 check if n and its double exist 4ms O(n) O(n) 87.06% 🟠
1351 count negative numbers in a sorted matrix 8ms O(log(n)) O(1) 99.26% 🟒
1356 sort integers by the number of 1 bits 12ms O(n*log(n)) O(n) 13.46% πŸ”΄
1370 increasing decreasing string 0ms O(n) O(n) 100% 🟒
1392 longest happy prefix 16ms O(n) O(n) 72.22% 🟠
1399 count largest group 0ms O(n) O(n) 100% 🟒
1403 minimum subsequence in non increasing order 4ms O(n*log(n)) O(n) 97.44% 🟒
1413 minimum value to get positive step by step sum 0ms O(n) O(n) 100% 🟒
1417 reformat the string 0ms O(n) O(n) 100% 🟒
1436 destination city 4ms O(n) O(n) 91.94% 🟒
1437 check if all 1s are at least length k places away 64ms O(n) O(1) 75% 🟠
1441 build an array with stack operations 0ms O(n) O(n) 100% 🟒
1464 maximum product of two elements in an array 4ms O(n) O(n) 91.3% 🟒
1480 running sum of 1d array 0ms O(n) O(n) 100% 🟒
1491 average salary excluding the minimum and maximum salary 0ms O(n) O(1) 100% 🟒
1502 can make arithmetic progression from sequence 0ms O(n*log(n)) O(n) 100% 🟒
1507 reformat date 0ms O(1) O(1) 100% 🟒
1528 shuffle string 4ms O(n) O(n) 87.5% 🟠
1544 make the string great 0ms O(n) O(n) 100% 🟒
1598 crawler log folder 0ms O(n) O(1) 100% 🟒
1640 check array formation through concatenation 0ms O(n) O(n) 100% 🟒
1672 richest customer wealth 0ms O(n^2) O(n) 100% 🟒
1673 find the most competitive subsequence 2860ms O(n^2) O(n) 8.33% πŸ”΄
1684 count the number of consistent strings 32ms O(n^2) O(n) 65% 🟠
1688 count of matches in tournament 0ms O(log(n)) O(1) 100% 🟒
1822 sign of the product of an array 4ms O(n) O(1) 96.21% 🟒
1827 minimum operations to make the array increasing 8ms O(n) O(1) 100% 🟒
1832 check if the sentence is pangram 0ms O(n) O(1) 100% 🟒
1903 largest odd number in string 4ms O(n) O(1) 97.06% 🟒
1974 minimum time to type word using special typewriter 0ms O(n) O(1) 100% 🟒
1984 minimum difference between highest and lowest of k scores 15ms O(n*log(n)) O(1) 85.85% 🟠
1991 find the middle index in array 0ms O(n) O(n) 100% 🟒
1995 count special quadruplets 12ms O(n^4) O(1) 82.41% 🟠
2000 reverse prefix of word 0ms O(n) O(n) 100% 🟒
2001 number of pairs of interchangeable rectangles 280ms O(n) O(n) 98.28% 🟒
2006 count number of pairs with absolute difference k 4ms O(n^2) O(1) 100% 🟒
2011 final value of variable after performing operations 4ms O(n) O(1) 100% 🟒
2016 maximum difference between increasing elements 0ms O(n) O(1) 100% 🟒
2027 minimum moves to convert string 0ms O(n) O(1) 100% 🟒
2500 delete greatest value in each row 32ms O(n^2) O(1) 100% 🟒
2501 longest square streak in an array 487ms O(n) O(n) 100% 🟒

JetBrains Leetcode Plugin Setup

file name template

$!{question.frontendQuestionId}_$!velocityTool.snakeCaseName(${question.titleSlug})/$!velocityTool.snakeCaseName(${question.titleSlug})

code template

package $!velocityTool.snakeCaseName(${question.titleSlug})

// https://leetcode.com/problems/${question.titleSlug}

// level: ${question.level}
// time:
// space:

${question.code}

About

Personal leetcode playground.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages