We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f36bb4 commit 282323aCopy full SHA for 282323a
src/main/java/com/fishercoder/solutions/firstthousand/_19.java
@@ -74,6 +74,9 @@ public ListNode removeNthFromEnd(ListNode head, int n) {
74
75
public static class Solution3 {
76
//a more concise version using the same idea
77
+ //i.e. sliding window
78
+ //Time: O(n)
79
+ //Space: O(1)
80
public ListNode removeNthFromEnd(ListNode head, int n) {
81
ListNode pre = new ListNode(-1);
82
pre.next = head;
0 commit comments