mission-peace / interview

Interview questions
Apache License 2.0
11.08k stars 5.17k forks source link

CheckIfArrayElementsAreConsecutive.java #122

Open abhishekbhattacharyya opened 8 years ago

abhishekbhattacharyya commented 8 years ago

This answer will fail if the array has negative integers.

https://github.com/mission-peace/interview/blob/master/src/com/interview/array/CheckIfArrayElementsAreConsecutive.java#L19

int input[] = {-1,-2,-3,-4};

neeraj-lad commented 7 years ago

The solution assumes that the input array is positive. The assumption has been mentioned in the geeksforgeeks link.

DipanshKhandelwal commented 7 years ago

Please assign this task to me ill do it.