Increasing Decreasing Sequence

I didn’t understand how to approach this problem without using arrays and list.
Hackerblock link https://hack.codingblocks.com/app/contests/987/p/194

Hi @harshkumar.877587

  1. Maintain 2 var : inc = 0, dec = 1
  2. start from second element
  3. check if (current > prev)
    a. if dec == 1 then
    dec = 0
    inc = 1
    b. if inc == 1
    continue
  4. else if (current <prev)
    a. if dec == 1
    continue
    b. if inc == 1
    return false
  5. else return false
  6. repeat 3. until array ends
  7. return true

Hope it helps
Mark resolved if satisifed :slight_smile: