Problem title
Difficulty
Avg time to solve

Distinct Subsets Count
Moderate
40 mins
Flipping Coins
Moderate
32 mins
Boundary Sum
Moderate
40 mins
Replace Node With Depth
Easy
20 mins
Execution Time
Moderate
15 mins
Euler’s Totient Function
Easy
15 mins
Spiral Matrix
Easy
--
Minimum Cost to Reach End
Moderate
25 mins
Design a hashset
Moderate
25 mins
Closest greater
Easy
15 mins 3

# Check If Linked List Is Palindrome

Difficulty: EASY
Avg. time to solve
15 min
Success Rate
85%

Problem Statement

#### For example, the lists (1 -> 2 -> 1), (3 -> 4 -> 4-> 3), and (1) are palindromes, while the lists (1 -> 2 -> 3) and (3 -> 4) are not.

##### Input Format:
``````The first line of input contains a single integer T, representing the number of test cases or queries to be run.

Then the T test cases follow.

The first and only line of each test case contains the elements of the linked list separated by a single space and terminated by -1. Hence, -1 would never be a list element.
``````
##### Output Format :
``````For each test case, print “True” if the given linked list is a palindrome, else print “False”.
``````
##### Note:
``````You do not need to print anything, it has already been taken care of. Just implement the given function.
``````
##### Constraints :
``````1 <= T <= 10
1 <= N <= 5 * 10^4
-10^9 <= data <= 10^9 and data != -1

Where N is the number of nodes in the linked list and ‘data’ represents the value of the nodes of the list.

Time Limit: 1sec
``````
##### Sample Input 1:
``````3
1 2 2 1 -1
8 9 9 -1
4 -1
``````
##### Sample Output 1:
``````True
False
True
``````
##### Explanation for Sample Input 1:
``````In the 1st test case, the given list is a palindrome.
In the 2nd test case, the given list is not a palindrome.
In the 3rd test case,  the given list is a palindrome.
``````
##### Sample Input 2:
``````2
3 2 1 -1
1 1 1 -1
``````
##### Sample Output 2:
``````False
True
``````   Console