Tap here to switch tabs
Problem
Submissions

Problem: Maximum Valid Pair Sum

Try to solve the Maximum Valid Pair Sum problem.

Statement

Given an integer array nums of length n and an integer k, determine the maximum possible sum of a pair of elements nums[i] and nums[j] such that 0≤i<j<n0 \leq i < j < n and j−i≥kj - i \geq k.

Return the maximum pair sum that satisfies the condition.

Constraints:

  • 2≤2 \leq n ==== nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq n −1- 1

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Valid Pair Sum

Try to solve the Maximum Valid Pair Sum problem.

Statement

Given an integer array nums of length n and an integer k, determine the maximum possible sum of a pair of elements nums[i] and nums[j] such that 0≤i<j<n0 \leq i < j < n and j−i≥kj - i \geq k.

Return the maximum pair sum that satisfies the condition.

Constraints:

  • 2≤2 \leq n ==== nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤\leq n −1- 1