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 am assuming you want 1 array for apples, and another for oranges. This would take O(n+m) space. Using arrays in this way would require more space, since we would be saving positions of all the fruit in the function.
I think the code fails since HackerRank sets on the amount of memory/space they let you use in this challenge.
Apple and Orange
You are viewing a single comment's thread. Return to all comments →
I am assuming you want 1 array for apples, and another for oranges. This would take O(n+m) space. Using arrays in this way would require more space, since we would be saving positions of all the fruit in the function.
I think the code fails since HackerRank sets on the amount of memory/space they let you use in this challenge.
HackerRank solutions.