Next greater element | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Next greater element

This is the problem I have solved for days called Next greater element. I know the logic but cannot get the code correct. https://code.sololearn.com/ctCBgSBeMX6S/?ref=app

29th Apr 2019, 2:25 AM
Khai123
Khai123 - avatar
2 Answers
+ 1
What is your code supposed to do? What's the logic behind it?
29th Apr 2019, 4:52 AM
Diego
Diego - avatar
0
if the next element greater than the current element, you print out the next one. if the next is < the current, the next becomes -1.
29th Apr 2019, 10:38 AM
Khai123
Khai123 - avatar