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.
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.
You are given n distinct points in the 2D plane. A boomerang is defined as a tuple of three points (i, j, k) where the distance between points i and j equals the distance between points i and k. Count the total number of boomerangs that can be formed from the given points.
Given a string, sort its characters based on their frequency of occurrence in descending order. If multiple solutions are possible, any valid answer is acceptable. The frequency of each character refers to how many times it appears in the string.
You are given four integer arrays nums1, nums2, nums3, and nums4 all of length n. Your task is to find the number of quadruples (i, j, k, l) such that nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0. The indices i, j, k, and l should be between 0 and n-1.
You are playing a game with a circular array where each element indicates how many steps to move forward or backward. Determine if there exists a cycle in the array where the cycle has more than one element and all elements in the cycle move in the same direction. Return true if such a cycle exists, otherwise return false.