How is it possible? While first element is smaller than the other. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is it possible? While first element is smaller than the other.

https://code.sololearn.com/cBjG8oWpgcRb/?ref=app

24th Jul 2021, 11:46 AM
TeaserCode
3 Answers
+ 2
Just an idea. Try to read the string backwards. If next char value was less than current char value, subtract If next char value was greater than current char value, add
24th Jul 2021, 11:57 AM
Ipang
+ 2
Ok now it works fine Good job! 👍
24th Jul 2021, 12:41 PM
Ipang
+ 1
I go backwad and it is supposed true. You should go backward because the second element is bigger than first.
24th Jul 2021, 12:30 PM
TeaserCode