Amazon interview question

Kadane's Algorithm and some modification to it, BFS implementation