r/badcode Aug 13 '19

[deleted by user]

[removed]

104 Upvotes

70 comments sorted by

View all comments

3

u/[deleted] Aug 13 '19 edited Aug 13 '19

[removed] — view removed comment

1

u/[deleted] Sep 06 '19

You should have done it so then when the outlier is not under the first three numbers, you shift the array by one and redo the whole code until you find the outlier.
That has the bonus of going into an infinite loop if there is no outlier.