8000 GitHub - kimi0230/LeetcodeGolang at c7ab0bb34b951f24980b35aea3beeac19c9c1839
[go: up one dir, main page]

Skip to content

kimi0230/LeetcodeGolang

Repository files navigation

Leetcode in Golang

Leetcode, Codility , GeekforGeeks algorithms exercises written in Golang.


leetcode Content

Data Structure

Array

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0001 Array Two Sum Go Easy O(n) O(n)
0003 Array Longest Substring Without Repeating Characters Go Medium O(n) O(1)
0015 Array 3 Sum Go Medium O(n^2) O(n)
0027 Array Remove Element Go Easy O(n) O(1)
0035 Array Search Insert Position Go Easy O(n), O(logn) O(1)
0059 Array Spiral Matrix II Go Medium O(n)) O(n^2)
0088 Array Merge Sorted Array Go Easy O(n)) O(1)

Stack

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0094 Stack Binary Tree Inorder Traversal Go Medium O(n)) O(1)

Linked List

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0141 Linked List Linked List Cycle Go Easy O(n) O(1)
0203 Linked List Remove Linked List Elements Go Easy O(n) O(1)

Algorithm

Sort

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0075 Sort Sort Colors Go Medium O(n)) O(1)

Backtracking (回溯法)

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0046 Backtracking Permutations (排列) Go Medium O(n) O(n)

Dynamic Programming

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0053 Dynamic Programming Maximum Subarray Go Easy O(n) O(n)
0322 Dynamic Programming Coin Change Go Medium O(nm) O(n)
0509 Dynamic Programming Fibonacci Number Go Easy 很多解法 很多解法

Sliding Window

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0209 Sliding Window Minimum Size Subarray Sum Go Medium O(n^2), O(n), O(nlog n) O(1), O(1), O(n)

Two Pointers

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0344 Two Pointers Reverse String Go Easy O(n) O(1)

Bit Manipulation

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0693 Bit Manipulation Binary Number with Alternating Bits Go Easy O(n), O(1) O(1)

Union Find

No. Topic Title Solution Difficulty TimeComplexity SpaceComplexity
0721 Union Find Accounts Merge Go Easy O(n), O(n log n) O(n), O(n)

Topic Title No. Solution Difficulty TimeComplexity SpaceComplexity
Sorting Find Minimum Difference Between Any Two Elements 0031 Go Basic O(n^2), O(n log n) O(n), O(n)

Codility Content

Topic Title Solution Difficulty TimeComplexity SpaceComplexity
Lesson 1 Iterations
Binary Gap
Go
Painless O(log n) O(1)
Lesson 2 Array
Cyclic Rotation
Go
Painless O(1) O(1)
Odd Occurrences In Array
Go
Painless O(n), O(n) O(n), O(1)
Lesson 3 Time Complexity
Frog Jmp
Go
Painless O(1) O(1)
Perm Missing Elem
Go
Painless O(n) O(1)
Tape Equilibrium
Go
Painless O(n) O(n)
Lesson 4 Counting Elements
Frog River One
Go
Painless O(n) O(n)
Max Counters
Go
Respectable O(n+m) O(n)
Missing Integer
Go
Respectable O(n) O(n)
Perm Check
Go
Painless O(n) O(n)
Lesson 5 Prefix Sums
Count Div
Go
Respectable O(1) O(1)
Genomic Range Query
Go
Respectable O(n+m) O(n)
MinAvg Two Slice
Go
Respectable O(n) O(n)
Passing Cars
Go
Painless O(n) O(1)
Lesson 6 Sorting
Distinct
Go
Painless O(nlogn) O(n)
Max Product of Three
Go
Painless O(nlogn) O(1)
Number Of Disc Intersections
Go
Respectable O(nlogn) O(n)
Triangle
Go
Painless O(nlogn) O(n)
Lesson 7 Stacks and Queues
Brackets
Go
Painless O(n) O(n)
Fish
Go
Painless O(n) O(n)
Nesting
Go
Painless O(n) O(1)
Stone Wall
Go
Painless O(n) O(n)
Lesson 8 Leader
Dominator
Go
Painless O(n) O(1)
EquiLeader
Go
Painless O(n) O(n)
Lesson 9 Maximum slice problem
Max Profit
Go
Painless O(n) O(1)
Max Slice Sum
Go
Painless O(n) O(n)
Max Double Slice Sum
Go
Respectable O(n) O(n)
Lesson 10 Prime and composite numbers
Count Factors
Go
Painless O(sqrt(n)) O(1)
Flags
Go
Respectable O(n) O(n)
MinPerimeterRectangle
Go
Painless O(sqrt(n))) O(1)
Peaks
Go
Respectable O( n*log( log(n) )) O(n)
Lesson 11 Sieve of Eratosthenes
(質數篩)
Count Non Divisible
Go
Respectable O(N * log(N)) O(n)
Count Semiprimes
Go
Respectable O(N*log(log(N))+M) O(N+M)
Lesson 12 Euclidean algorithm
(輾轉相除法 or 歐幾里得算法)
Chocolates By Numbers
Go
Painless O(log(N + M)) O(1)
Common Prime Divisors
Go
Respectable O(Z * log(max(A) + max(B))**2) O(1)
Lesson 13 Fibonacci numbers
FibFrog
Go
Respectable O(N * log(N)) O(N)
Ladder

Respectable
Lesson 14 Binary search algorithm
MinMaxDivision

Respectable
NailingPlanks

Respectable
Lesson 15 Caterpillar method
AbsDistinct

Painless
CountDistinctSlices

Painless
CountTriangles

Painless
MinAbsSumOfTwo

Respectable
Lesson 16 Greedy algorithms
MaxNonoverlappingSegments

Painless
TieRopes

Painless
Lesson 17 Dynamic programming
MinAbsSum

Ambitious
NumberSolitaire

Respectable

Reference

0