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.
question asks "longest subarray" that should be continuous elements from the original array, so not allowed to change order. Thats what the example shows.
Then on input: 1 2 2 3 1 2
expected answer: 5.
Thats for sure wrong. Question worded incorrectly.
After sorting the inputarray my sollution passes.
So the question means SUBSET: any combination of elements regardless of order or position
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →
question asks "longest subarray" that should be continuous elements from the original array, so not allowed to change order. Thats what the example shows. Then on input: 1 2 2 3 1 2 expected answer: 5.
Thats for sure wrong. Question worded incorrectly. After sorting the inputarray my sollution passes. So the question means SUBSET: any combination of elements regardless of order or position