id doesn't work if we want to count char frequency ignoring the case of char ex : if i write Aarjun then freq of A =1 and a =1 what to do in this situation??
you can apply either (string name.toUpperCase) or (string name.toLowerCase) and store it back to the same string if ya want. by now i think u already know haha
what if the user want to check the occurrence of three or more letters. for example the user input a string: "how are you" and user want to get the occurrence for the letter: oru what will be the code?
Create a map of character and count. And then add the count of characters. Map charMapCount = new HashMap(); for(Character c : str.toCharArray()) { if(charMapCount.containsKey(c)) { charMapCount.put(c, charMapCount.get(c) + 1); } else { charMapCount.put(c, 1); } } int count = 0; int sum = 0; for(Map.Entry entry : charMapCount.entrySet()) { //Check for character and the do the sum if(charMapCount.containsKey(ch)) { sum = sum + charMapCount.get(ch); } }
i did not fount any channel like this .good explination and different programs ,,,,,,,,,,,,how many ways to solve a problem
Thank you
great.
Thank you
Best video 🎉
Thanks
you didnt explain what is map,chaemapcount,hashmap etc,as a beginner very difficult to understand
In my new videos, i have explained all the functions which is present used in code.
Is it possible to solve this problem without using map data structure??
I also want to know
id doesn't work if we want to count char frequency ignoring the case of char
ex : if i write Aarjun then freq of A =1 and a =1
what to do in this situation??
You have to ignore the letter case.
you can apply either (string name.toUpperCase) or (string name.toLowerCase) and store it back to the same string if ya want.
by now i think u already know haha
bhai thoda tej bolo please i could hardly hear you..
Get(c)+1 what is purpose of adding 1 ??
It means we are incrementing the value by 1 whenever we encounter the same value.
what if the user want to check the occurrence of three or more letters. for example the user input a string: "how are you" and user want to get the occurrence for the letter: oru what will be the code?
Hi Rosabel, In this case print the occurrence of only these characters.
for(int i = 0; i< sentence.length(); i++){for(int x=0; x
Create a map of character and count. And then add the count of characters.
Map charMapCount = new HashMap();
for(Character c : str.toCharArray()) {
if(charMapCount.containsKey(c)) {
charMapCount.put(c, charMapCount.get(c) + 1);
} else {
charMapCount.put(c, 1);
}
}
int count = 0;
int sum = 0;
for(Map.Entry entry : charMapCount.entrySet()) {
//Check for character and the do the sum
if(charMapCount.containsKey(ch)) {
sum = sum + charMapCount.get(ch);
}
}
Thanks. I will try it
your sound is so low
shortest man 😎 well explained just speak little more loud
Haha, Sure
Well... explained 😃
Thank you.
Which application are u using to compile java?
It's eclipse.