4

I feel a bit confused rigt now.
Did i misunderstand something with this random little excercise?

" Write a Java program to find the index of a value in a sorted array. If the value does not find return the index where it would be if it were inserted in order. Example:
[1, 2, 4, 5, 6] 5(target) -> 3(index)
[1, 2, 4, 5, 6] 0(target) -> 0(index)
[1, 2, 4, 5, 6] 7(target) -> 5(index) "

Here is what i did lol:
https://gist.github.com/laim2003/...

And here is the official solution:
https://gist.github.com/laim2003/...

Their solution seems a bit unnecessary complicated lol or am i wrong

Comments
Add Comment