chhabraamit's blog

By chhabraamit, 12 years ago, In English

This is my code for problem. I am using greedy and getting WA . Can someone help me to find bug in above code .

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

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Challenge:

4  
5 3 4 3  

Answer is 3

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Your algorithm is not right.

counter example :- 7 1 5 1 Your Output is :- 6 Should be :- ?