• + 1 comment

    You load the entire data set into memory and hold it there until the end of the program, which makes a nonsense of your space efficiency claim. You traverse the data set twice - once to parse it, a second time to check the differences. The second traversal is in fact multiple traversals, since all elements other than the first two are examined at least twice.

    In the queue solution described above, no input element need be evaluated more than once and no more than d elements are ever held in memory. You don't come close to that performance.

    Your efficiency claims are invalid. Your code passes the test suites, but that means little since the test suites passed the inefficient code written by the puzzle setter.