(LinkedListNode head, int k)
| 42 | } |
| 43 | |
| 44 | public static LinkedListNode nthToLastR3(LinkedListNode head, int k) { |
| 45 | Result res = nthToLastR3Helper(head, k); |
| 46 | if (res != null) { |
| 47 | return res.node; |
| 48 | } |
| 49 | return null; |
| 50 | } |
| 51 | |
| 52 | public static LinkedListNode nthToLast(LinkedListNode head, int n) { |
| 53 | LinkedListNode p1 = head; |