leetcode中国-leetcode:刷算法了

时间:2024-07-19 14:34:36
【文件属性】:

文件名称:leetcode中国-leetcode:刷算法了

文件大小:75KB

文件格式:ZIP

更新时间:2024-07-19 14:34:36

系统开源

leetcode中国 Leetcode Set Matrix Zeroes 第一种 通过一次遍历记录所有为0的索引(Python中enumerate()输出当前列表的索引) 再遍历一次, 根据记录的索引进行置0 第二种 通过一次遍历所有为0的索引, 设置当前索引的行列的第一个数为0, 作为标记, 如a[9][9]为0, 所以设置a[0][9],a[9][0]为0 再遍历一次, 根据标识的索引进行置0 Min Stack 数据结构为两个栈, 一个记录最小值的栈, 一个是存放正常压栈数据 入栈的时候判断新加入的数是否小于或等于最小值栈里的top 出栈时判断出栈数字和最小栈里的是否相等 Evaluate Reverse Polish Notation 逆波兰的后半截实现 Linked List Cycle 快慢指针 Linked List Cycle II 快慢指针再加个初始指针 慢指针到链表开始位置时, 快指针总是比他快k步(每次移动快1步, 移动k次), 第一次相遇的时候快慢指针位置距离链表起始位置差k步即在n-k的位置(链表环长度为n) Majority Element 多数投票算法


【文件预览】:
leetcode-master
----House Robber II.py(551B)
----Length of Last Word.c(191B)
----Minimum Genetic Mutation.py(820B)
----Top K Frequent Elements.py(320B)
----Pairs of Songs With Total Durations Divisible by 60.py(1KB)
----Evaluate Reverse Polish Notation.py(612B)
----Majority Element.java(445B)
----Maximum Sum of Two Non-Overlapping Subarrays.py(4KB)
----Convert Sorted List to Binary Search Tree.py(833B)
----Minimum Depth of Binary Tree.py(548B)
----Peak Index in a Mountain Array.py(502B)
----Construct Binary Tree from Preorder and Postorder Traversal.py(731B)
----Compare Version Numbers.py(472B)
----Remove Nth Node From End of List.py(921B)
----Set Matrix Zeroes.py(619B)
----Maximum Length of a Concatenated String with Unique Characters.py(752B)
----Power of Two.py(259B)
----Binary Tree Preorder Traversal.py(782B)
----Remove Duplicates from Sorted List.py(815B)
----Valid Parenthesis String.py(975B)
----Toeplitz Matrix.py(502B)
----Invert Binary Tree.py(426B)
----Unique Number of Occurrences.py(498B)
----Delete Columns to Make Sorted II.py(576B)
----Jump Game II.c(347B)
----Reverse Nodes in k-Group.c(859B)
---- Bitwise AND of Numbers Range.py(227B)
----Combination Sum IV.py(469B)
----Number of Matching Subsequences.py(980B)
----Sort Characters By Frequency.py(830B)
----Search Insert Position.java(551B)
----Minimum Swaps To Make Sequences Increasing.py(610B)
----Palindrome Linked List.c(883B)
----Binary Tree Level Order Traversal.py(657B)
----Remove Element.py(172B)
----Integer Replacement.py(382B)
----Remove K Digits.py(494B)
----Power of Three.py(284B)
----Sqrt(x).py(150B)
----Total Hamming Distance.py(8KB)
----Delete Node in a BST.py(842B)
----Permutation in String.py(10KB)
----Add Digits.py(188B)
----Reorganize String.py(808B)
----Linked List Cycle.c(283B)
----Max Consecutive Ones III.py(703B)
----Word Ladder.py(21KB)
----Knight Dialer.py(664B)
----Simplify Path.py(379B)
----.gitignore(10B)
----Shortest Path with Alternating Colors.py(1KB)
----Binary Tree Inorder Traversal.py(775B)
----Reverse Linked List II.c(578B)
----Permutations.py(300B)
----Two Sum II - Input array is sorted.py(543B)
----Verify Preorder Serialization of a Binary Tree.py(318B)
----Coin Change 2.py(504B)
----Path Sum.py(868B)
----K Closest Points to Origin.py(38KB)
----Merge Sorted Array.py(367B)
----Binary Tree Postorder Traversal.py(790B)
----README.md(22KB)
----Uncommon Words from Two Sentences.py(596B)
----Minimum Add to Make Parentheses Valid.py(417B)
----Reverse Linked List.c(375B)
----LRU Cache.py(2KB)
----Minimum Path Sum.java(577B)
----Min Stack.py(442B)
----Climbing Stairs.c(229B)
----Linked List Cycle II.c(437B)
----Majority Element II.java(1KB)
----Valid Boomerang.py(598B)
----Construct Binary Tree from Preorder and Inorder Traversal.java(2KB)

网友评论