Madhees interview question

Tweaked Kadane's algorithm Get random in o(1)