• + 1 comment
    def atNodeFromTail(head,position):
        cur = head
        stack = []
        while cur != None:
            stack.append(cur.data)
            cur = cur.next
        return stack[-position-1]
    

    Simple Solution with O(N) complexity

    • + 0 comments

      https://github.com/shahiakhilesh1304/DSA/blob/main/Solution/Question16/SolutionScreenShots/image.png

      For the reference of the code