filmov
tv
Code With Me - Episode 001 - Beautiful Strings
![preview_player](https://i.ytimg.com/vi/2RaasANTBcA/maxresdefault.jpg)
Показать описание
In this, the premier of my new 'Code With Me' series, I take on the Code Eval challenge 'Beautiful Strings'.
We solve the challenge by creating a std::array that holds the number of each character in our string. Next, we count all the characters from a line of the input file. We then sort the std::array using std::sort from low to high. Finally, we calculate our maximum 'Beauty Score' by multiplying an incrementing point value to each character count in our sorted array and summing the results.
Please subscribe for more, and feel free to ask questions!
We solve the challenge by creating a std::array that holds the number of each character in our string. Next, we count all the characters from a line of the input file. We then sort the std::array using std::sort from low to high. Finally, we calculate our maximum 'Beauty Score' by multiplying an incrementing point value to each character count in our sorted array and summing the results.
Please subscribe for more, and feel free to ask questions!