Блог пользователя skpro19

Автор skpro19, история, 7 лет назад, По-английски

This is the problem .

According to the accepted solution of other coders, the following test case gives a "Yes". But, shouldn't it give a "No" ?

6 1 2 1 1 1 1 1 1 6

Any help would be really appreciated.

  • Проголосовать: нравится
  • -10
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Note that the non-decreasing and the non-increasing sequences are also considered ladders.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yeah, I understand that.

    But the given query is on the range of [1, 6]. In that range, the sequence is [2, 1, 1, 1, 1, 1].

    So, it is decreasing, and then non-decreasing/non- increasing. Hence, this doesn't qualify as a ladder.

    Because the question says, it should satisfy either of the three criteria:

    1. It first doesn't decrease, and then doesn't increase.
    2. It doesn't decrease
    3. It doesn't increase.

    But, the given is decreasing and then non- decreasing. Hence, it doesn't qualify in either of the three criteria.