Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    Practice problems / Palindrome linked list

    Palindrome linked list

    Easylinked listtwo pointersfast and slow pointers

    Return true if the list's values read the same forwards and backwards. Try O(1) extra memory.

    Example 1

    Input:  head = [1,2,2,1]
    Output: true

    Example 2

    Input:  head = [1,2]
    Output: false

    Constraints

    • 1 ≤ number of nodes ≤ 10⁵
    • 0 ≤ Node.val ≤ 9

    Submit checks your solution against 11 tests, including hidden ones.

    // Provided by the judge: keep these definitions
    class ListNode {
      constructor(val = 0, next = null) {
        this.val = val
        this.next = next
      }
    }
    
    /**
     * @param {ListNode|null} head
     * @return {bool}
     */
    function isPalindrome(head) {
      
    }
    
    Sign in to run
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.