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 is kind of poorly written, but should give the right results. It can certainly be done all in one for loop though, and in my opinion, using a string array is much cleaner than using a switch statement.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
For Loop
You are viewing a single comment's thread. Return to all comments →
It is kind of poorly written, but should give the right results. It can certainly be done all in one for loop though, and in my opinion, using a string array is much cleaner than using a switch statement.