Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
@Phrancis'DROPTABLEUsers-- the last edits I made were to make my problem more understandable. if you understood what I did, it was mainly making a different test so the output would be clear, as answers below didn't answer exactly to the problem. I DID NOT use answers from below to enhance the code.
@kezzos Sorry if the goal wasn't that clear, here it is: * Find the longest path following these rules. Longest path means the maximum number of nodes where we are always going down. * If we have many longest paths with equal distance ( number of nodes), then we should get the one with the maximum drop ( value of 1st node - value of the last node).