#3584

Maximum Product of First and Last Elements of a Subsequence

medium · 31.3% accepted · 114 likes · top 9%

array · two pointers

Description

You are given an integer array nums and an integer m.

Return the maximum product of the first and last elements of any subsequence of nums of size m.

Solution