Solution using stacks


  • 0
    H

    in first case, we can call reverse(..) function on the linkedlist and then do the addition.
    In second case when reversal of the linked list is not allowed, we can use a stack to store the data(do one traversal of the linked list and compute the addition.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.