← All problemsSign in

Find Maximum S

You are given an array A[] of size N. Let define the function S(i, j) (1 <= i < j <= N) as - ![image](https://s3.amazonaws.com/hr-assets/0/1642440249-8449d763d8-Untitleddocument.png) Find the maximum value of S among all the possible values. For exapmle - Let A[] = {4, -1, 5, 4} S(1, 2) = 9, maximum value is 9. ### Input The input consists of multiple test cases. The first line contains an i

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start