Hacker News new | ask | show | jobs
by indweller 2747 days ago
Found something weird with codes posted in the links. I am getting different outputs for the intermediate and the final codes for the input of "5; 1,2,3,4,4". Can someone help?

1. https://imgur.com/a/u8O65AF

2. https://imgur.com/a/uHniZof

3 comments

> Starting from an array A that has n distinct integers

I don't know in what ways they are differents, but these programs were not designed to work with duplicates in the input. This probably explains the results.

Yeah you're right
Is the input valid per definition of the problem?
Got it. The input is not valid for the problem.