摘要: "869. 重新排序得到 2 的幂" 枚举排列,然后验证。比较暴力。 其实好一点的做法应该反过来,先把int范围下的2的N幂算出来,然后一个一个验证给出的数能不能拼成。 class Solution { public Integer[] nextPermutation(Integer[] nums) 阅读全文
posted @ 2018-07-15 11:01 ACBingo 阅读(547) 评论(0) 推荐(0) 编辑
摘要: "868. 二进制间距" 读懂题意就出来了 class Solution { public int binaryGap(int N) { String s = Integer.toBinaryString(N); int ans = 0; int k = 1; int i = 0; while (s 阅读全文
posted @ 2018-07-15 10:58 ACBingo 阅读(201) 评论(0) 推荐(0) 编辑