Skip to content

Commit 282323a

Browse files
update 19
1 parent 7f36bb4 commit 282323a

File tree

1 file changed

+3
-0
lines changed
  • src/main/java/com/fishercoder/solutions/firstthousand

1 file changed

+3
-0
lines changed

src/main/java/com/fishercoder/solutions/firstthousand/_19.java

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public ListNode removeNthFromEnd(ListNode head, int n) {
7474

7575
public static class Solution3 {
7676
//a more concise version using the same idea
77+
//i.e. sliding window
78+
//Time: O(n)
79+
//Space: O(1)
7780
public ListNode removeNthFromEnd(ListNode head, int n) {
7881
ListNode pre = new ListNode(-1);
7982
pre.next = head;

0 commit comments

Comments
 (0)