You are given two gene strings, startGene and endGene, both consisting of 8 characters. You also have a gene bank of valid gene strings that can be mutated into one another. A mutation is defined as changing one character at a time, and the mutated gene string must exist in the gene bank. Your task is to determine the minimum number of mutations needed to transform startGene into endGene. If transformation is impossible, return -1.
Given an array of intervals, where each interval is represented by a pair of integers [start, end], the goal is to determine the minimum number of intervals to remove to make the rest non-overlapping. Intervals that only touch at a point are considered non-overlapping.
You are given an array of intervals, where each interval is represented by a pair of integers [start, end], and the start value is unique. For each interval, find the right interval. The right interval for an interval i is an interval j such that start[j] >= end[i] and the start[j] is minimized. If no right interval exists, return -1.
You are given the root of a binary tree and an integer targetSum. Your task is to count the total number of paths in the tree where the sum of node values along the path equals targetSum. The path does not need to start or end at the root or a leaf, but it must go downwards (from parent to child nodes).
You are given two strings, s and p. Return the list of start indices of all the anagrams of string p in string s. An anagram of p is a rearrangement of the characters of p, and the start indices should be returned in any order.
Given an array of characters, compress it by replacing consecutive repeating characters with the character followed by the count of repetitions. If the character repeats only once, just include the character. The result should modify the input array and return the new length of the array.