We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
letter is a frequency array - you count how many appearances of each letter of alphabet are there in your string. So, at letter[0] you have frequency for 'a', at letter[1] for 'b' etc. For example, if your c within the loop at some point is 'd', then 'd' - 'a' = 100 - 97 = 3, (100 and 97 are respective character codes) and you do required operation on letter[3]
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →
letter is a frequency array - you count how many appearances of each letter of alphabet are there in your string. So, at letter[0] you have frequency for 'a', at letter[1] for 'b' etc. For example, if your c within the loop at some point is 'd', then 'd' - 'a' = 100 - 97 = 3, (100 and 97 are respective character codes) and you do required operation on letter[3]