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.
Your solution is bad for the problem as it is today. You are printing the elements, but the problem, at least today, says you should return the array. If you do the assigning to the array in one line then it is not possible to check when to assign, so you will always assign, which will be much slower. For this reason i will have to give a downvote to your answer. Still pretty cool for a problem that ask to print them instead of returning, tho
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Grading Students
You are viewing a single comment's thread. Return to all comments →
Your solution is bad for the problem as it is today. You are printing the elements, but the problem, at least today, says you should return the array. If you do the assigning to the array in one line then it is not possible to check when to assign, so you will always assign, which will be much slower. For this reason i will have to give a downvote to your answer. Still pretty cool for a problem that ask to print them instead of returning, tho