terminal
Elevo
/
ESC
Login
Initiate Registration
code
Topics
corporate_fare
Companies
history
History
arrow_back
Back to Challenges
#19
Remove Nth Node From End of List
Medium
Acceptance 0%
Editorial
description
Problem Description
Given the `head` of a linked list, remove the `n`th node from the end of the list and return its head.
checklist
Constraints
The number of nodes in the list is sz.
1 <= sz <= 30
0 <= Node.val <= 100
1 <= n <= sz
science
Examples
Case #1
In:
head = [1,2,3,4,5] n = 2
Out:
[1,2,3,5]
Case #2
In:
head = [1] n = 1
Out:
[]
Mastery Tags
Linked List
Two Pointers
Hiring Companies
Amazon
Meta
Microsoft
code
Integrated IDE
Python 3
expand_more
C
C++ 17
Java
JavaScript
Python 3
C
C++ 17
Java
JavaScript
Python 3
refresh
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: pass
Login to Compile
Processing
terminal
Debug Output
home
Home
extension
Practice
robot_2
login
Sign In
account_circle
Menu
code_blocks
Coding
psychology
Aptitude
Navigation
close
Login
Registration