Python 2 simple solutions
Python :\n\n1 :\n\n\nclass Solution:\n    def getLengthOfLL(self, head: Optional[ListNode]) -> int:\n        length = 0\n        \n        while head:\n        
**Python :**\n\n**1 :**\n\n```\nclass Solution:\n    def getLengthOfLL(self, head: Optional[ListNode]) -> int:\n        length = 0\n        \n        while head:\n            length += 1\n            head = head.next\n            \n        return length\n            \n    def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:\n        temp = head\n        length = self.getLengthOfLL(temp)\n        if n == length:\n            return head.next\n        \n        if length == 1:\n            return None\n        \n        i = 1\n        \n        while temp and i < (length - n):\n            temp = temp.next\n            i += 1\n        \n        temp.next = temp.next.next        \n        return head\n```\n\n**2 :**\n```\ndef removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:\n\tfast = head\n\tslow = head\n\n\twhile n:\n\t\tfast = fast.next\n\t\tn -= 1\n\n\tif not fast:\n\t\treturn head.next\n\n\twhile fast.next:\n\t\tslow = slow.next\n\t\tfast = fast.next\n\n\tslow.next = slow.next.next\n\treturn head\n```\n\n**Like it ? please upvote !**\n\n
['Python', 'Python3']