Skip to content

Bug Report for reverse-a-linked-list #3948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chowvincent96 opened this issue Mar 20, 2025 · 0 comments
Open

Bug Report for reverse-a-linked-list #3948

chowvincent96 opened this issue Mar 20, 2025 · 0 comments

Comments

@chowvincent96
Copy link

chowvincent96 commented Mar 20, 2025

Getting this error when trying to run test cases or submit an answer when my answer is the following:

 public ListNode reverseList(ListNode head) {
        if(head == null) return null;
        ListNode result = new ListNode(0, head);
        ListNode prev = result;
        // x -> 0 -> 1 -> 2
        // p    c
        while(head != null) {
            ListNode next = head.next;
            head.next = prev;
            prev = head;
            head = next;
        }
        return prev;
    }

run.sh: line 1: 3 Killed /usr/local/jdk17/bin/java --module-path /usr/local/javafx-sdk-22.0.2/lib --add-modules javafx.web,javafx.fxml,javafx.swing,javafx.controls,javafx.media,javafx.base,javafx.graphics Main

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant