Python solution
\nclass Solution:\n    def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:\n        if head.next is None:\n            return No
```\nclass Solution:\n    def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:\n        if head.next is None:\n            return None\n        \n        size=0\n        curr= head\n        while curr!= None:\n            curr= curr.next\n            size+=1\n        if n== size:\n            return head.next\n        \n        indexToSearch= size-n\n        prev= head\n        i=1\n        while i< indexToSearch:\n            prev= prev.next\n            i+=1\n        prev.next= prev.next.next\n        return head\n```\n\n**UPVOTE** *is the best encouragement for me... Thank you*\uD83D\uDE01
['Linked List', 'Python']