Create T22.java

This commit is contained in:
Mrhongxing committed 2026-10-24 21:30:52 +08:00
1 parent 99ed42d095
commit bb6dc9dd05
1 file changed
+46
+46
View File
@@ -0,0 +1,46 @@
package com.hong.www;
import java.util.*;
public class T22 {
public int g(int x){
int sum=1;
int temp=0;
while(x>=sum){
sum*=2;
}
sum/=2;
while(sum>=1){
if(x>=sum){
x-=sum;
temp++;
}
sum/=2;
}
return temp;
}
public int test(int numCourses, int[] first,int[] second) {
ArrayList<Integer> list1 = new ArrayList<>();
ArrayList<Integer> list2 = new ArrayList<>();
for(int x:first){
for(int y:second){
if(x==y){
x=0;
y=0;
}
}
}
Arrays.sort(first);
Arrays.sort(second);
for(int x:first){
}
return 0;
}
public static void main(String[] args) {
T22 t = new T22();
System.out.println(t.g(4));
}
}