polar9527 / leetcode-1

🌓in the dead of night

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LeetCode

刷题步骤

1.新建题目

1 题 two-sum

go run main.go -a=1

100 题 same-tree

go run main.go -a=100

2.模板流

3.目录约定 生成 readme.md

分类 : 1 级目录

题名 : 2 级目录

算法名 : 3-N 级目录

执行 go run main.go 自动生成 readme.md

模板

数据结构



Array

# Title Acceptance Difficulty Solution Algorithm
0001 Two Sum 48.0% Easy Go hash table
0004 Median of Two Sorted Arrays 37.2% Hard Go binary search
0011 Container With Most Water 62.3% Medium Go two pointer
0015 3Sum 26.3% Medium Go two pointer
0016 3Sum Closest 43.6% Medium Go two pointer
0018 4Sum 37.4% Medium Go two pointer
0026 Remove Duplicates from Sorted Array 49.4% Easy Go two pointer
0027 Remove Element 57.9% Easy Go two pointer
0030 Substring with Concatenation of All Words 30.1% Hard Go two pointer
0033 Search in Rotated Sorted Array 36.6% Medium Go binary search
0034 Find First and Last Position of Element in Sorted Array 39.3% Medium Go binary search
0035 Search Insert Position 45.4% Easy Go binary search
0036 Valid Sudoku 59.0% Medium Go dfs
0037 Sudoku Solver 60.7% Hard Go dfs
0041 First Missing Positive 37.9% Hard Go bit map
0042 Trapping Rain Water 50.4% Hard Go two pointer
0121 Best Time to Buy and Sell Stock 53.8% Easy Go
0122 Best Time to Buy and Sell Stock II 58.6% Easy Go
1295 Find Numbers with Even Number of Digits 82.1% Easy Go
1365 How Many Numbers Are Smaller Than the Current Number 82.5% Easy Go
1389 Create Target Array in the Given Order 81.9% Easy Go

LinkedList

# Title Acceptance Difficulty Solution Algorithm
0002 Add Two Numbers 37.0% Medium Go
0019 Remove Nth Node From End of List 38.3% Medium Go two pointer
0021 Merge Two Sorted Lists 60.8% Easy Go
0023 Merge k Sorted Lists 49.7% Hard Go
0024 Swap Nodes in Pairs 65.1% Medium Go
0025 Reverse Nodes in k-Group 57.6% Hard Go
0206 Reverse Linked List 68.4% Easy Go

Math

# Title Acceptance Difficulty Solution Algorithm
0007 Reverse Integer 34.0% Easy Go
0008 String to Integer (atoi) 20.3% Medium Go
0009 Palindrome Number 57.3% Easy Go
0012 Integer to Roman 63.0% Medium Go
0013 Roman to Integer 61.1% Easy Go
0029 Divide Two Integers 19.4% Medium Go
0031 Next Permutation 33.1% Medium Go
0066 Plus One 43.7% Easy Go
0191 Number of 1 Bits 66.1% Easy Go
0292 Nim Game 69.7% Easy Go
0319 Bulb Switcher 45.3% Medium Go
1266 Minimum Time Visiting All Points 81.0% Easy Go
1403 Minimum Subsequence in Non-Increasing Order 71.0% Easy Go

Stack

# Title Acceptance Difficulty Solution Algorithm
0020 Valid Parentheses 41.3% Easy Go
0032 Longest Valid Parentheses 30.1% Hard Go

String

# Title Acceptance Difficulty Solution Algorithm
0003 Longest Substring Without Repeating Characters 33.6% Medium Go
0005 Longest Palindromic Substring 29.2% Medium Go
0006 ZigZag Conversion 47.3% Medium Go
0010 Regular Expression Matching 27.1% Hard Go
0014 Longest Common Prefix 36.8% Easy Go
0017 Letter Combinations of a Phone Number 53.1% Medium Go
0028 Implement strStr() 39.7% Easy Go
0038 Count and Say 54.8% Easy Go
0043 Multiply Strings 42.0% Medium Go
0415 Add Strings 49.7% Easy Go
0771 Jewels and Stones 82.1% Easy Go hash table

Tree

# Title Acceptance Difficulty Solution Algorithm
0022 Generate Parentheses 73.8% Medium Go dfs.catalan
Go dfs.recursive
0039 Combination Sum 68.7% Medium Go dfs.recursive
0040 Combination Sum II 61.0% Medium Go dfs.recursive
0094 Binary Tree Inorder Traversal 70.9% Medium Go dfs.inorder.recursive
Go dfs.inorder.stack
Go dfs.morris.break
Go dfs.morris.keep
0095 Unique Binary Search Trees II 62.3% Medium Go dfs.catalan
0096 Unique Binary Search Trees 65.2% Medium Go catalan
Go dp
0098 Validate Binary Search Tree 29.7% Medium Go bfs
Go dfs.inorder.recursive
Go dfs.inorder.stack
Go dfs.preorder.recursive
Go dfs.preorder.stack
0099 Recover Binary Search Tree 56.1% Hard Go dfs.inorder.recursive
Go dfs.inorder.stack
Go dfs.morris
0100 Same Tree 57.0% Easy Go dfs.recursive
0101 Symmetric Tree 50.7% Easy Go dfs.recursive
0102 Binary Tree Level Order Traversal 61.4% Medium Go bfs.queue
Go dfs.recursive
0103 Binary Tree Zigzag Level Order Traversal 54.1% Medium Go bfs.queue
Go dfs.recursive
0104 Maximum Depth of Binary Tree 72.7% Easy Go dfs
0105 Construct Binary Tree from Preorder and Inorder Traversal 64.8% Medium Go
0106 Construct Binary Tree from Inorder and Postorder Traversal 67.7% Medium Go
0107 Binary Tree Level Order Traversal II 64.7% Easy Go bfs.queue
Go dfs.recursive
0108 Convert Sorted Array to Binary Search Tree 70.1% Easy Go dfs.recursive
0109 Convert Sorted List to Binary Search Tree 71.3% Medium Go array
Go inorder
Go recursive
0110 Balanced Binary Tree 51.0% Easy Go postorder
Go top
0111 Minimum Depth of Binary Tree 41.9% Easy Go bfs
Go dfs
0112 Path Sum 49.4% Easy Go dfs
0113 Path Sum II 59.0% Medium Go dfs
0114 Flatten Binary Tree to Linked List 68.3% Medium Go preorder.morris
0116 Populating Next Right Pointers in Each Node 57.2% Medium Go bfs
Go dfs
0117 Populating Next Right Pointers in Each Node II 46.8% Medium Go bfs
0124 Binary Tree Maximum Path Sum 39.8% Hard Go dfs
0129 Sum Root to Leaf Numbers 62.6% Medium Go dfs
0144 Binary Tree Preorder Traversal 65.0% Medium Go dfs.recursive
Go dfs.stack
Go morris.break
Go morris.keep
0145 Binary Tree Postorder Traversal 70.9% Hard Go dfs.recursive
0173 Binary Search Tree Iterator 72.1% Medium Go
0199 Binary Tree Right Side View 63.9% Medium Go bfs
Go dfs
0222 Count Complete Tree Nodes 68.0% Medium Go dfs
Go two pointer
0226 Invert Binary Tree 74.6% Easy Go dfs
0230 Kth Smallest Element in a BST 69.6% Medium Go dfs
0235 Lowest Common Ancestor of a Binary Search Tree 63.1% Easy Go dfs
0236 Lowest Common Ancestor of a Binary Tree 61.2% Medium Go dfs
0257 Binary Tree Paths 63.2% Easy Go dfs
0297 Serialize and Deserialize Binary Tree 46.0% Hard Go bfs
Go dfs
0404 Sum of Left Leaves 54.4% Easy Go dfs
0429 N-ary Tree Level Order Traversal 65.1% Medium Go bfs
0437 Path Sum III 54.7% Easy Go dfs
Go hash table
0449 Serialize and Deserialize BST 50.9% Medium Go dfs.preorder
0450 Delete Node in a BST 39.4% Medium Go dfs
0501 Find Mode in Binary Search Tree 44.2% Easy Go dfs.recursive
0508 Most Frequent Subtree Sum 62.9% Medium Go dfs
0513 Find Bottom Left Tree Value 68.9% Medium Go bfs
0515 Find Largest Value in Each Tree Row 58.9% Medium Go bfs
0530 Minimum Absolute Difference in BST 56.2% Easy Go dfs
0538 Convert BST to Greater Tree 60.0% Easy Go dfs
0543 Diameter of Binary Tree 49.2% Easy Go dfs
0559 Maximum Depth of N-ary Tree 68.9% Easy Go bfs
Go dfs
0563 Binary Tree Tilt 54.0% Easy Go dfs
0572 Subtree of Another Tree 44.1% Easy Go dfs
0589 N-ary Tree Preorder Traversal 72.8% Easy Go dfs.recursive
Go dfs.stack
0590 N-ary Tree Postorder Traversal 72.8% Easy Go dfs.recursive
Go dfs.stack
0606 Construct String from Binary Tree 52.9% Easy Go dfs
0617 Merge Two Binary Trees 75.8% Easy Go dfs.recursive
0623 Add One Row to Tree 50.7% Medium Go bfs
0637 Average of Levels in Binary Tree 63.8% Easy Go bfs
0653 Two Sum IV - Input is a BST 54.7% Easy Go dfs
0669 Trim a Binary Search Tree 64.7% Easy Go dfs
0671 Second Minimum Node In a Binary Tree 46.0% Easy Go dfs
0687 Longest Univalue Path 39.5% Easy Go dfs
0700 Search in a Binary Search Tree 72.7% Easy Go dfs
0701 Insert into a Binary Search Tree 73.6% Medium Go dfs
0783 Minimum Distance Between BST Nodes 52.1% Easy Go dfs
0814 Binary Tree Pruning 73.1% Medium Go dfs
0872 Leaf-Similar Trees 62.5% Easy Go dfs
0938 Range Sum of BST 76.5% Easy Go
0951 Flip Equivalent Binary Trees 62.2% Medium Go dfs
0965 Univalued Binary Tree 67.3% Easy Go dfs
0979 Distribute Coins in Binary Tree 66.1% Medium Go dfs
1008 Construct Binary Search Tree from Preorder Traversal 71.9% Medium Go dfs
1302 Deepest Leaves Sum 80.2% Medium Go dfs
1315 Sum of Nodes with Even-Valued Grandparent 80.0% Medium Go dfs

About

🌓in the dead of night


Languages

Language:Go 100.0%