problem link : https://www.codechef.com/problems/STONES
link to my solution : CodeChef: Practical coding for everyone
problem link : https://www.codechef.com/problems/STONES
link to my solution : CodeChef: Practical coding for everyone
my approach :
I created two boolean arrays for size 54 for storing each character as true or false
1 to 26 stores ‘a’ to ‘z’ and 27 to 52 stores ‘A’ to ‘Z’ as true or false.
Then both the array’s are compared and the number of common character’s is found.
I guess that multiple instances of a stone occurring has to be counted.
Input:
1
ab
aa
Your output : 1
Correct output : 2