You are given two strings, word1 and word2, each of length n. The two strings are considered almost equivalent if the difference in frequency of each letter between word1 and word2 is at most 3. Return true if they are almost equivalent, or false otherwise.
You are given a queue of n people, where each person wants to buy a specific number of tickets. The task is to determine the time taken for the person at index k to finish buying all their tickets.
You are given an integer array ’nums’ and an integer ‘k’. You need to find a subsequence of ’nums’ of length ‘k’ such that the sum of its elements is maximized. A subsequence is a sequence that can be derived from another array by deleting some or no elements without changing the order of the remaining elements. Return any subsequence with the largest sum.
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 consisting of only the characters ‘a’ and ‘b’. Your task is to determine if all occurrences of ‘a’ appear before all occurrences of ‘b’ in the string. If that is the case, return true; otherwise, return false.
You are given a string consisting of multiple words separated by spaces. For each word, you need to change the capitalization based on the length of the word. If the word has 1 or 2 letters, it should be entirely in lowercase. If the word has 3 or more letters, the first letter should be uppercase and the remaining letters should be lowercase. Return the modified string with the updated capitalization for each word.