You are given a string ‘word’ and a character ‘ch’. Reverse the portion of the string starting at index 0 and ending at the index of the first occurrence of ‘ch’. If ‘ch’ is not found, return the original string.
You are given the head of a linked list. Your task is to remove the middle node from the linked list and return the modified list. The middle node is defined as the ⌊n / 2⌋th node, where n is the number of nodes in the list, using 0-based indexing.
Alice and Bob are tasked with watering a garden of n plants. The plants are arranged in a row and need varying amounts of water. Alice waters the plants from left to right, while Bob waters them from right to left. They both begin with full watering cans. If they don’t have enough water for the next plant, they refill their cans. In case they both reach the same plant, the one with more water in their can should water the plant, or Alice waters it in case of a tie. The goal is to determine how many times Alice and Bob have to refill their cans to water all the plants.
Given a list of words, return the first word that is a palindrome. A palindrome is a word that reads the same forwards and backwards. If no palindromic word is found, return an empty string.
You are given a string s and an array spaces. The array contains indices where spaces need to be inserted into the string. Each space should be added before the character at the respective index. Return the modified string with the spaces inserted.
You are given a linked list with an even number of nodes. Each node in the list has a twin located symmetrically from the center of the list. Specifically, the ith node is the twin of the (n-1-i)th node, where n is the total number of nodes in the list. For example, the first node is the twin of the last node, the second node is the twin of the second last node, and so on. The twin sum is defined as the sum of a node and its twin. Your task is to return the maximum twin sum of the linked list.