That is not the correct sample data set for this problem as problem statement specifies that input array must be sorted.
Although I realized that repl was pointing to code base of different problem.I have attached a right code base now.
Yeah I was using repl code example and just changed last element. Was pointing this out because I know some people learning Java will try stuff with the code and be confused about results.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.