Tap here to switch tabs
Problem
Submissions

Problem: Maximum Product of First and Last Subsequence Elements

Try to solve the Maximum Product of First and Last Elements of a Subsequence problem.

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

Try to solve the Maximum Product of First and Last Elements of a Subsequence problem.

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