approach's blog

By approach, history, 3 years ago, In English

Problem Link so, I was able to come up with memoization approach, but unable to write iterative version.

The correct one happens to be

Correct implementation

But I failed to realise, why this one is wrong.

wrong one

could u help me out please, any kind of help on how to approach such iterative DP problems, will be appreciated.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By approach, history, 3 years ago, In English

I know how to increase values in an array from 'L' to 'R' by a constant no.

  • first value by 1
  • second value by 1
  • third value by 1

but unable to figure out how to increment value like ..

  • first value by 1
  • second value by 2
  • third value by 3 and so.....

Problem was :: Angry Cyborg

I tried few approaches like decreasing R + 1th element by R — L + 1 and so but they didn't seem to work.

I am stuck in this question, can u please provide any hint. You have my thanks !!

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it