All Posts

Leetcode 846: Hand of Straights

Alice has a set of cards, each with a value written on it. She wants to rearrange these cards into groups, where each group consists of groupSize consecutive cards. Given an integer array hand where hand[i] represents the value on the ith card, and an integer groupSize, return true if she can rearrange the cards into groups of consecutive numbers, or false otherwise.

Leetcode 848: Shifting Letters

You are given a string s of lowercase English letters and an array shifts, where shifts[i] represents the number of times to shift the first i + 1 characters of s. The shift operation for a letter means moving to the next letter in the alphabet, and if the letter is ‘z’, it wraps around to ‘a’. After applying all the shifts, return the final string.

Leetcode 851: Loud and Rich

You are given a group of n people, each with a unique amount of money and quietness. An array richer specifies the relationships between people where richer[i] = [ai, bi] indicates that person ai has more money than person bi. You are also given an array quiet where quiet[i] represents the quietness of person i. Your task is to return an array answer where answer[x] is the person y who has the least quietness among all people who have equal or more money than person x.

Leetcode 852: Peak Index in a Mountain Array

You are given a mountain array arr of length n, where the values first strictly increase to a peak element and then strictly decrease. Your task is to find the index of the peak element in the array. The peak element is an element that is greater than both its neighbors.

Leetcode 853: Car Fleet

You are given several cars starting at different positions along a road. Each car has a specific speed and is trying to reach a target destination. A car cannot pass another car, but it can catch up and travel at the speed of the slower car. Cars that travel together form a fleet. Your task is to determine the number of car fleets that will reach the target.

Leetcode 860: Lemonade Change

You are managing a lemonade stand where each lemonade costs $5. Customers are standing in line to buy one lemonade each, paying with either a $5, $10, or $20 bill. Your task is to determine if you can provide the correct change to every customer as they arrive in line. At the start, you have no change, and you must provide each customer with the appropriate change for their bill.