Show my java recursive solutions, only by using stack, no extra space used.

  • 0

    public class Solution {
    boolean isPalin = true;
    public boolean isPalindrome(ListNode head) {
    if(head == null || == null) return true;
    return isPalin;
    private ListNode helpder(ListNode top,ListNode tail){
    if(tail == null) return top;
    ListNode newTop = helpder(top,;
    if(newTop.val != tail.val){
    isPalin = false;

Log in to reply

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