Author: prakashsinghabody@gmail.com

Interview Questions

Palindrome Linked List

Leetcode#234 Palindrome Linked List Problem Statement Given the head of a singly linked list, return true if it is a  palindrome  or false otherwise. Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1,2] Output: false Constraints:  Follow up: Could you do it in O(n) time and O(1) space? Golang Solution – 1 Recursion method Solution -2 Please visit https: https://codeandalgo.com for more such […]

prakashsinghabody@gmail.com 
Interview Questions

Reverse Linked List

Reverse Linked List LeetCode#206 Problem Statment Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Example 2: Input: head = [1,2] Output: [2,1] Example 3: Input: head = [] Output: [] Constraints: Follow up: A linked list can be reversed either iteratively or recursively. […]

prakashsinghabody@gmail.com