Kindly check the code
Last case is showing TLE
There are many mistakes in your code such as
In function haven’t defined base case.
If(head==null or head->next ==null)
Return false
Refer this code https://ide.codingblocks.com/s/353950 as it’s been coded by me and it will surely help you in understanding This problem In a better way 