![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
其他
其他
zjc4j
驼厂打工人。
展开
-
位1的个数
题目题源代码public class Solution { // you need to treat n as an unsigned value public int hammingWeight(int n) { // n &= n-1,这个操作可以去除二进制数的最后一个1 int count = 0; while (n != 0) { n &= (n - 1); cou原创 2021-08-05 23:13:27 · 63 阅读 · 0 评论 -
排列的序列
题目题源代码码源class Solution { public List<List<Integer>> res = new ArrayList<>(); public int count = 0; public int locate_k; public String getPermutation(int n, int k) {int[] sequence = new int[n]; for(int i = 0; i &原创 2021-07-03 22:05:24 · 86 阅读 · 0 评论 -
丑数 III
题目题源代码码源class Solution { public int nthUglyNumber(int n, int a, int b, int c) { if (a == 1 || b == 1 || c == 1) return n; long ab = lcm(a, b); long ac = lcm(a, c); long bc = lcm(b, c); long abc = lcm(ab原创 2021-07-03 19:54:42 · 127 阅读 · 0 评论