• + 95 comments

    I'm not sure if it was just me, but my problem was with the way the question was phrased?

    "Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is <= 1."

    So, if our array was 4, 6, 5, 3, 3, 1

    I assumed from the question that we would check every integer for the absolute difference. For example:

    Check 4 - 6, 4 - 5, 4 - 3, 4 - 3, 4 - 1. Then: Check 6 - 5, 6 - 3, 6 - 3, 6 - 1. So on and so forth.

    I realised at the end I interpreted the question incorrectly, but is it just me who misread the question?