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's elegant, but wouldn't this solution be slower and less space efficient? Since each call for a.Count() would have to go through the array and you have to store in an array? Where as you can just go through the list with one iteration and then print?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
It's elegant, but wouldn't this solution be slower and less space efficient? Since each call for a.Count() would have to go through the array and you have to store in an array? Where as you can just go through the list with one iteration and then print?