Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product of First and Last Subsequence Elements

Maximum Product of First and Last Subsequence Elements asks you to choose a subsequence at least a given length and return the maximum product of its first and last values, numbers may be negative.

Statement

Given an integer array nums and an integer m, return the maximum product of the first and last elements of a subsequence of nums that has a length of at least m.

Note: A subsequence is a sequence obtained by deleting zero or more elements from the array without changing the relative order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −105≤-10^5 \leq nums[i] ≤105\leq 10^5

  • 1≤1 \leq m ≤\leq nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product of First and Last Subsequence Elements

Maximum Product of First and Last Subsequence Elements asks you to choose a subsequence at least a given length and return the maximum product of its first and last values, numbers may be negative.

Statement

Given an integer array nums and an integer m, return the maximum product of the first and last elements of a subsequence of nums that has a length of at least m.

Note: A subsequence is a sequence obtained by deleting zero or more elements from the array without changing the relative order of the remaining elements.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • −105≤-10^5 \leq nums[i] ≤105\leq 10^5

  • 1≤1 \leq m ≤\leq nums.length