isListPalindrome | Linked List | Data Structure

// Singly-linked lists are already defined with this interface:// template<typename T>// struct ListNode {//   ListNode(const T &v) : value(v), next(nullptr) {}//   T value;//   ListNode *next;// };//bool isListPalindrome(ListNode<int> * l) {    ListNode<int> * fast=l;    ListNode<int> *slow =l;    while(fast != nullptr && fast->next != nullptr){            fast = (fast->next)->next;            slow = slow->next;        }            ListNode<int> *current = slow;    ListNode<int> *prev = NULL;    ListNode<int> *next = NULL;    while (current != NULL) {             // Store next             next = current->next;               // Reverse current node's pointer             current->next = prev;               // Move pointers one position ahead.             prev = current;             current = next;         }         slow = prev;        fast = l;                while(slow != NULL){                        if(fast->value != slow->value){                return false;            }            fast = fast->next;            slow = slow->next;        }        return true;}

Middle Element Of Linked List | Linked List | Data Structure

/*** Definition for singly-linked list.* struct ListNode {* int val;* ListNode *next;* ListNode(int x) : val(x),…

Find All Duplicates in an Array | Array |Data Structure

  class Solution {public:      vector<int> findDuplicates(vector<int>& nums) {           vector<int>output;           for(int i =0;i<nums.size();i++){                     int index = abs(nums[i])…

removeKFromList | Linked List | Data Structure

// Singly-linked lists are already defined with this interface:// template<typename T>// struct ListNode {//   ListNode(const T &v) : value(v), next(nullptr) {}//   T value;//   ListNode *next;// };//ListNode<int> * removeKFromList(ListNode<int> * l, int k) {    while(l != NULL && l->value ==k){        l = l->next;    }    ListNode<int> * current = l;    while(current != NULL && current->next != NULL){        if(current->next->value == k){            current->next = current->next->next;        }else{            current = current->next;        }    }    return l;}

HOW TO STUDY | SOLID MECHANICS

Complete guide of how to study solid mechanics for semester and competitive exams like GATE. High…

HOW TO STUDY | BASIC MECHANICAL ENGINEERING | BME

Complete guide of how to study BME for semester and competitive exams like GATE. High quality…

HOW TO STUDY | BASIC ELECTRONIC AND ELECTRICAL ENGINEERING | BEEE

NOTES: Practical Manual QUESTION PAPERS: Semester Question Paper BOOKS: References 1. Electrical technology H Cotton, Reem…

HOW TO STUDY | ENVIRONMENT SCIENCE

Complete guide of how to study enviornemnt engineering for semester exams. High quality notes with question…

HOW TO STUDY | ENGINEERING CHEMISTRY

NOTES: Class Notes PRACTICALS: Lab Manual Lab Manual QUESTION PAPERS: Semester Question Paper BOOKS: References 1.Engineering…

HOW TO STUDY | MATHEMATICS 2

NOTES: QUESTION PAPERS: Semester Question Papers BOOKS: References 1.Advanced engineering Mathematics Erwin Krevszig, John Wiley &…