Construct Winning Sequence

Problem Overview

  • Build a strictly increasing-then-decreasing integer sequence that ranks highest by comparing elements from the start.
  • Input: sequence length and allowed integer range; Output: the winning sequence or -1 if not possible.
  • Framed as a programming competition scenario selecting the best valid sequence.
  • This Salesforce interviews coding interview problem is a frequent interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: