Longest Subset With Consecutive Numbers

Given a set of numbers, find the longest subset of consecutive numbers.

Example:
Input:
1 3 8 14 4 10 2 11
Output:
1 2 3 4


Please try solving this problem before jumping on the solution

Click to learn






Subscribe for more updates



Algorithm/Insights

Please watch the video for explanation.


Contribution

  • Sincere thanks from IDeserve community to Virendra Karappa for compiling current post.


    Virendra Karappa