上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 44 下一页
摘要: 问题: 给定一个数组,使用对数组元素减-1的方式,使得数组成为一个zigzag锯形数组。 求最少减的数量 Example 1: Input: nums = [1,2,3] Output: 2 Explanation: We can decrease 2 to 0 or 3 to 1. Example 阅读全文
posted @ 2020-06-14 14:32 habibah_chang 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一组学生身高,要对其进行身高排序,从低到高。 求最少要移动几个学生的位置。 Example 1: Input: heights = [1,1,4,2,1,3] Output: 3 Explanation: Current array : [1,1,4,2,1,3] Target arra 阅读全文
posted @ 2020-06-14 12:56 habibah_chang 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个字符串数组,和一个字典字符串, 若字符串数组中的一个字符串中的所有字符,能够在字典字符串中一一对应找到(字典中每个字符只能用一次),则返回这个字符串的长度。 最终返回满足条件的所有字符串长度之和。 Example 1: Input: words = ["cat","bt","hat" 阅读全文
posted @ 2020-06-14 12:32 habibah_chang 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个0,1组成的数组,前 i 个元素组成二进制数,若该二进制数能被5整除,返回true,否则返回false 求出这个数组前 i 个元素(i=0~size()-1)的结果数组。 Example 1: Input: [0,1,1] Output: [true,false,false] Exp 阅读全文
posted @ 2020-06-13 13:15 habibah_chang 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个字符串s, 和一个字串操作数组queries [i, j, k] 即对字符串s的i~j字符组成的子串,进行重新排列,且可从中最多(up to)选取k个字母,替换成任意字母, 使得子串能够成为回文字符串。 如果可以返回true,否则返回false。 Example : Input: s 阅读全文
posted @ 2020-06-13 12:19 habibah_chang 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,如果刚好将数组分成三段,使得每一段的和相等,则返回true,否则返回false Example 1: Input: A = [0,2,1,-6,6,-7,9,1,2,0,1] Output: true Explanation: 0 + 2 + 1 = -6 + 6 - 7 + 9 阅读全文
posted @ 2020-06-13 11:01 habibah_chang 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 问题: 给出一列歌曲所花时间的数组。 求任意两首歌合起来时间是60分钟的倍数的组队pair数。 Example 1: Input: [30,20,150,100,40] Output: 3 Explanation: Three pairs have a total duration divisibl 阅读全文
posted @ 2020-06-07 14:53 habibah_chang 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 问题: 给出一个数组,和一个目标值target 求一个数值value,将数组中所有>value的数换成value后,使得数组和最接近target Example 1: Input: arr = [4,9,3], target = 10 Output: 3 Explanation: When usin 阅读全文
posted @ 2020-06-07 13:34 habibah_chang 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个航班预定列表,每一项为 [i, j, k],意思是从 i ~ j 航班,每个航班都需要预定k个座位。 一共有n个航班,即 1<=i<=j<=n,求满足这个列表的航班1~n的座位数列表。 Example 1: Input: bookings = [[1,2,10],[2,3,20],[ 阅读全文
posted @ 2020-06-07 11:15 habibah_chang 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定一个数组,求交换其中两个元素,使得到数组全部元素组成下一个较小的数值 Example 1: Input: [3,2,1] Output: [3,1,2] Explanation: Swapping 2 and 1. Example 2: Input: [1,1,5] Output: [1 阅读全文
posted @ 2020-06-06 13:02 habibah_chang 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 44 下一页