### Form a Rectangle from boundary elements of Matrix using Linked List

class Node:          def __init__(self, val):        self.data = val        self.next = None        self.prev = None        self.top = None        self.bottom = None    class LinkedList:          def __init__(self):        self.head = None              def Quad(self, grid,…

### Reverse a singly Linked List in groups of given size | Set 4 (Space efficient approach)

class LinkedList {          Node head;          class Node {        int data;        Node next;        Node(int d)        {            data = d;            next = null;        }    }      Node reverse(Node node, int k)    {        if (k == 1)            return…

### Multiply a single digit number in place to a number represented as a Linked List

#include using namespace std;  class Node {public:    int data;    Node* next;};  Node* newNode(int data){        Node* new_node = new Node;          new_node->data = data;    new_node->next = NULL;          return new_node;}  Node* reverse(Node*…

### Partition a Linked List into 3 parts such that the maximum difference between their sizes is minimum

#include using namespace std;  class Node {public:    int data;    Node* next;};  int sizeOfLL(Node* head){    int size = 0;          while (head != NULL) {        ++size;        head = head->next;    }    return size;}  vector…

### Modify a Linked List to contain last occurrences of every duplicate element

#include using namespace std;  class Node {public:    int data;    Node* next;      Node(int x)    {        this->data = x;        this->next = NULL;    }};  Node* reverseList(Node* head){    Node *prev = NULL, *nextNode =…

### Subtract 1 from a number represented as Linked List

#include using namespace std;  class Node {public:    int data;    Node* next;};  Node* newNode(int data){        Node* new_node = new Node;    new_node->data = data;    new_node->next = NULL;          return new_node;}  int subtractOneUtil(Node*…