作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典+二分查找 日期 题目地址:https://leetcode-cn.com/problems/shortest-distance-to-target-color/ 题目描述 You are given an array colors, in which there are three colors: 1, 2 and 3. You are also…
题目要求 Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Note: S string length is in [1, 10000]. C is a single character, and guaranteed to be in string S. All letters…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 过两遍数组 日期 题目地址:https://leetcode.com/problems/shortest-distance-to-a-character/description/ 题目描述 Given a string S and a character C, return an array of integers representing the…
[LeetCode]697. Degree of an Array 解题报告 标签(空格分隔): LeetCode 题目地址:https://leetcode.com/problems/degree-of-an-array/description/ 题目描述: Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of…
[LeetCode]802. Find Eventual Safe States 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/find-eventual-safe-states/description/ 题目描述: In a directed graph, we start at some node and every turn, w…
[LeetCode]779. K-th Symbol in Grammar 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/k-th-symbol-in-grammar/description/ 题目描述: On the first row, we write a 0. Now in every subsequent row, we lo…
[LeetCode]792. Number of Matching Subsequences 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/number-of-matching-subsequences/description/ 题目描述: Given string S and a dictionary of words words,…
[LeetCode]881. Boats to Save People 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/boats-to-save-people/description/ 题目描述: The i-th person has weight people[i], and each boat can carry a maximu…
[LeetCode]813. Largest Sum of Averages 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/largest-sum-of-averages/description/ 题目描述: We partition a row of numbers A into at most…
[LeetCode]166. Fraction to Recurring Decimal 解题报告(Python) 标签(空格分隔): LeetCode 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/fraction-to-recurring-decimal/description/ 题目描述: Given two integers representing t…