Dan Thanh
Almost Increasing Sequence

Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.

Note: sequence a0, a1, ..., an is considered to be a strictly increasing if a0 < a1 < ... < an. Sequence containing only one element is also considered to be strictly increasing.

Input description

Funtion name: almostIncreasingSequence

Inputs:

  • sequence: array.integer
  • 105sequence[i]105-10^5 ≤ sequence[i] ≤ 10^5.

Output description

boolean - Return true if it is possible to remove one element from the array in order to get a strictly increasing sequence, otherwise return false.

Courses

Tags

Blog

Tags

About

Discover Cardano at your own pace and become proficient in this transformative technology with our unbiased and user-friendly resources