- 博客(5)
- 收藏
- 关注
原创 Leetcode 670 解析: Maximum Swap(最大交换) - Python
文章目录题目描述题目分析代码实现日期题目描述Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1:Input: 2736Output: 7236Explanation: Swap the number 2 and the numbe
2021-02-10 17:17:50 409
原创 Leetcode 547 解析: Number of Provinces (Python)
文章目录题目描述题目分析方案一 (depth first search(DFS)深度优先搜索)代码实现日期题目描述There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly wi
2021-02-02 22:17:48 490
原创 Leetcode 1512: Number of Good Pairs(Python)
文章目录题目描述题目分析方案一(brute force)方案二(等差数列)代码实现方案一(brute force)方案二(等差数列)日期题目描述Given an array of integers nums.A pair (i,j) is called good if nums[i] == nums[j] and i < j.Return the number of good pairs.Example 1:Input: nums = [1,2,3,1,1,3]Output: 4Ex
2021-01-31 16:35:44 168 1
原创 Leetcode 876: Middle of the Linked List (Python)
文章目录题目描述题目分析代码实现日期题目描述Given a non-empty, singly linked list with head node head, return a middle node of linked list.If there are two middle nodes, return the second middle node.Example 1:Input: [1,2,3,4,5]Output: Node 3 from this list (Serializatio
2021-01-28 23:14:09 168 1
原创 Leetcode1290: Convert Binary Number in a Linked List to Integer (Python)
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档文章目录题目描述题目分析代码实现日期题目描述Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number.Return the dec
2021-01-25 10:50:08 196 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人