Your friend is typing their name on a keyboard. Sometimes, while typing, a key might be long pressed, causing the character to be typed multiple times. Given the name and the typed string, determine if it is possible that the typed string could have been the result of long pressing some characters while typing the name.
Given the root of a binary search tree and two integers, low and high, return the sum of values of all nodes whose values are within the inclusive range [low, high]. You can assume that all nodes in the tree have distinct values.
In a town with n people, one person may be the judge. The judge trusts no one and is trusted by everyone else. Given a list of trust relationships, identify the town judge or return -1 if no judge exists.
Given a list of words, return an array of characters that appear in all words. The output should include duplicates of characters as they appear in each word, and the answer can be returned in any order.
In this problem, we have an array of integers representing stones. Each stone has a weight, and on each turn, we choose the two heaviest stones, smash them together, and apply the following rules: If the two stones have the same weight, both are destroyed. If they have different weights, the stone with the smaller weight is destroyed, and the stone with the larger weight gets reduced by the smaller stone’s weight. The process continues until at most one stone remains. Your task is to return the weight of the last remaining stone. If no stones are left, return 0.