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.
It gets the relative index of the letter, so a is 0, b is 1, etc. by casting an int to a char, you get its ascii value. He is subtracting by the correct offset, 97, to get the indices in a range from 0-25. Hope I could help!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
It gets the relative index of the letter, so a is 0, b is 1, etc. by casting an int to a char, you get its ascii value. He is subtracting by the correct offset, 97, to get the indices in a range from 0-25. Hope I could help!