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.
I had the same issue, even though my solution wasn't the same.
It was caused by the fact that I was calling my solving function with arr directly instead of a copy of it. As in the function itself, arr is modified, the second call wasn't made using initial data but using modified data.
asc=homework(n,list(arr))# -> works
also, I like the syntax:
asc=solve(s,ar[::])desc=solve(s,ar[::-1])
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Lily's Homework
You are viewing a single comment's thread. Return to all comments →
I had the same issue, even though my solution wasn't the same. It was caused by the fact that I was calling my solving function with
arr
directly instead of a copy of it. As in the function itself,arr
is modified, the second call wasn't made using initial data but using modified data.also, I like the syntax: