int a = 7;
char result = (char) (a + '0'); // '7'
// usuall result we dont use that
//here assicc of 2 is added to asicss of 0 and making a wrong character
char a = '2';
char result = (char) (a + '0'); // 'r'
question 5 th
if you want to get the common elements between 2 words
for example ayush piyush
// pass ayush and piyush to count and then take the intersection of both the array
1.public int[] count(String string){
int[] ap = new int[26];
char[] st = string.toCharArray();
for(int i =0;i<st.length;i++){
ap[st[i]-'a']++;
}
return ap;
}
}
public int[] intersection(int[] a , int[] b){
int[] t = new int[26];
for(int i =0;i<26;i++){
t[i]= Math.min(a[i],b[i]);
}
return t;
}
question 6
// priority queue k ander remove wala fuction khud dekh k remove krdega hai
for(int i = 1;i<groupSize;i++){
if(ayush.remove(value+i)){ // ager vo value presrnt hogi toh remove krdega
continue;
}
question 5 th if you want to get the common elements between 2 words for example ayush piyush
question 6 // priority queue k ander remove wala fuction khud dekh k remove krdega hai