@shuxu said in Java O(n) incredibly short yet easy to understand AC solution:

1.a>0, two ends in original array are bigger than center if you learned middle school math before.

2.a<0, center is bigger than two ends.

Some Clarifications:

For a > 0 case: it should be : Either the 1st element or last element in the array should greater than mid element. And it's obvious that the max value would be one of them.

Pics talks better:(I don't use the integer strictly but the logic is the same)

Similar logic could be applied to a < 0 case, in a reverse way.

Even though I don't understand why if a==0, b's sign doesn't matter but the Top-Voted solution seems can handle this case. (When a =0, It become a linear function).