Hello @chygoz2, thank you for participating in Week 2 of Algorithm Fridays.
This is a decent solution and I like that you included edge case checks and error-handling. Really clean!
I also like that you used the
I've posted my solution here. Do let me know what you think.
Thanks @meekg33k. I agree with you about the
The nature of the question revealed that it would be almost impossible to find a solution that wouldn't require going through the entire array, resulting in a time complexity of
In terms of algorithm complexity,
I very much like your solution as it actually results in shorter program execution time, even though the time complexity is still linear.