摘要:
"40. 组合总和 II" 这题跟上题做法几乎一样,只不过每个数能取多次改成了最多能取一次,同时candidates可能会出现相同字符,感觉还没有上一个题难。 代码仅需改两处即可,直接看代码把,有注释的地方即是改过的 class Solution { public List combinationS 阅读全文
摘要:
"868. 二进制间距" 读懂题意就出来了 class Solution { public int binaryGap(int N) { String s = Integer.toBinaryString(N); int ans = 0; int k = 1; int i = 0; while (s 阅读全文