From bb6dc9dd05ce06d27091801b0251a7b105f4bc46 Mon Sep 17 00:00:00 2001 From: Mrhongxing <154480715+Mrhongxing@users.noreply.github.com> Date: Sat, 24 Oct 2026 21:30:52 +0800 Subject: [PATCH] Create T22.java --- src/com/hong/www/T22.java | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/com/hong/www/T22.java diff --git a/src/com/hong/www/T22.java b/src/com/hong/www/T22.java new file mode 100644 index 0000000..0447082 --- /dev/null +++ b/src/com/hong/www/T22.java @@ -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 list1 = new ArrayList<>(); + ArrayList 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)); + } +}