摘要: 问题: 给定一个数组,如过将其中每X个相同的数组成一个group,正好分完,其中X>=2,成立的话,返回true,否则返回false Example 1: Input: deck = [1,2,3,4,4,3,2,1] Output: true Explanation: Possible parti 阅读全文
posted @ 2020-05-24 14:26 habibah_chang 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定01组成的字符串,求反转(0->1 or 1->0)最少次数,使得成为0...001..11(0..00 or 1..11)这样的单调增字符串。求反转次数。 Example 1: Input: "00110" Output: 1 Explanation: We flip the last 阅读全文
posted @ 2020-05-24 14:04 habibah_chang 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 问题: 给定数组,判断若为单调增(A[i]>=A[i-1])或者单调减(A[i]<=A[i-1])数组,则返回true,否则返回false。 Example 1: Input: [1,2,2,3] Output: true Example 2: Input: [6,5,4,4] Output: tr 阅读全文
posted @ 2020-05-24 10:57 habibah_chang 阅读(133) 评论(0) 推荐(0) 编辑