java tail recursive solution

  • 0
    public class Solution {
        public ListNode removeElements(ListNode head, int val) {
            if (head == null) return head;
            ListNode tail = removeElements(, val);
            if (head.val == val)
                return tail;
            else {
       = tail;
                return head;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.