Algorithm · Google · Medium
Maximum Total Minus Middle Medium · Topics · Company Tags · Hints You are given an integer array A of length N (0-indexed). Choose two distinct indices L and R with L R-1, then I = 0. You want to maximize the value V = T - I. If several (L, R) pairs give the same maximum V, output the lexicographically smallest pair (smallest L, then smallest R). Print L, R, and V separated by spaces. Example 1: Explanation: For L=0, R=2, T=5+(-1)+9=13, I=-1, so V=14 = 5+9. Example 2:…
Checking your access…