You are viewing a single comment's thread. Return to all comments →
Preliminary test doesn't cover half of possible cases. To check it more o less well I would suggest next test case extension.
Input: 4 4 5 1 4 5 3 2 4 4 2 2 4 3 6 11 2 3 5 6 2 4 2 3 4 5 3 6 11 3 5 4 3 2 4 2 6 5 3 2
Expected output: 1 4 1 2 1 6 3 5
It makes sure that you always take first two suitable numbers in a row and output their positions in proper order.
The next is spoiler solution. Don'r read it if you like to do it yourself. I did it by sorting dataset first by price, end then by index in original array and doing search moving towards the middle from opposit directions.
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Preliminary test doesn't cover half of possible cases. To check it more o less well I would suggest next test case extension.
Input:
4
4
5
1 4 5 3 2
4
4
2 2 4 3
6
11
2 3 5 6 2 4 2 3 4 5 3
6
11
3 5 4 3 2 4 2 6 5 3 2
Expected output:
1 4
1 2
1 6
3 5
It makes sure that you always take first two suitable numbers in a row and output their positions in proper order.
The next is
spoilersolution. Don'r read it if you like to do it yourself.I did it by sorting dataset first by price, end then by index in original array and doing search moving towards the middle from opposit directions.