0

Anagram

So I have got this question where it asks to input two strings and check if they are Anagram(basically if the all the letters of first string are present in the second one.Example — "Note" and "Tone").After countless hours of brainstroming I couldnt reach the solution.Hence I searched the web for an solution and got the code I have attached below but i dont get it.Can anyone of you explain me this? https://sololearn.com/compiler-playground/c8wnosySZkWG/?ref=app

5th Feb 2025, 1:16 PM
Arnav
Arnav - avatar
6 Antworten
0
Hello! I have explained the anagram code you sent. Please pay attention to the comments...: https://sololearn.com/compiler-playground/coU2w10gqggU/?ref=app
5th Feb 2025, 2:26 PM
Dragon RB
Dragon RB - avatar
0
Thanks for your time.I do have a follow up question.Can we use increment operators with arrays too? And what does it do also can you explain the line 62 Dragon RB
5th Feb 2025, 2:37 PM
Arnav
Arnav - avatar
0
Arnav , for (int nums: count) is an enhanced for loop (or a for-each loop). In this case it basically means you are iterating through the items that are inside the `count` array. This can be useful if you only want to iterate through the array and don't want to access the items using indexes.
5th Feb 2025, 2:45 PM
Dragon RB
Dragon RB - avatar
0
And, you can't use the increment operator on an array.
5th Feb 2025, 2:50 PM
Dragon RB
Dragon RB - avatar
0
Arnav I've updated the code a little bit. If you still don't understand, feel free to let me know.
5th Feb 2025, 2:56 PM
Dragon RB
Dragon RB - avatar
0
I get it now, thanks also I devised a new method to solve this code wanna check it out to pick out errors (if any) Dragon RB
5th Feb 2025, 4:06 PM
Arnav
Arnav - avatar