摘要: 问题: 给定一个数组,使用对数组元素减-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) 编辑