Skip to content

Conversation

@anujnegi341
Copy link

Earlier solution was not working for test cases like {-4, -2, 0, -1, -6} which has 0 as max value and also nos greater than 0 are 0. But after sorting when the loop iterates, it may sometimes skip 0 when the digit after array is 0( as A[i]==A[i+1] continue , skips this 0 ). You may check this on interviewbit.

Earlier solution was not working for test cases like {-4, -2, 0, -1, -6} which has 0 as max value and also nos greater than 0 are 0. But after sorting when the loop iterates, it may sometimes skip 0 when the digit after array is 0( as A[i]==A[i+1] continue , skips this 0 ). You may check this on interviewbit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant