All Posts

Leetcode 809: Expressive Words

You are given a string s and a list of query words. Each word in the query list is said to be ‘stretchy’ if it can be transformed into string s by extending groups of adjacent letters. You can extend a group of letters (e.g., ‘a’, ‘bb’, ‘ccc’) as long as its length is at least 3. For example, if s = ‘heeellooo’, you could extend ’e’ and ‘o’ to make ‘hello’ stretchy. Return the number of query strings that can be stretched to become s.

Leetcode 825: Friends Of Appropriate Ages

You are given an integer array ages, where each element represents the age of a person on a social media platform. A person will not send a friend request to another person if any of the following conditions are true:

  1. The recipient’s age is less than or equal to half of the sender’s age plus 7.
  2. The recipient’s age is greater than the sender’s age.
  3. The recipient’s age is greater than 100 and the sender’s age is less than 100.

Otherwise, the sender can send a friend request. Return the total number of friend requests made between people.

Leetcode 826: Most Profit Assigning Work

You are given a list of jobs, each with a difficulty level and a profit value, and a list of workers, each with a certain ability. A worker can only complete jobs with a difficulty level that is at most equal to the worker’s ability. Each worker can complete at most one job, but jobs can be assigned to multiple workers. The goal is to calculate the maximum total profit by assigning the jobs to workers based on their abilities.

Leetcode 838: Push Dominoes

In a line of n dominoes, each domino is initially standing upright. Some dominoes are pushed either to the left or the right. Over time, falling dominoes will cause adjacent dominoes to fall in the same direction. If a domino is pushed from both sides, it remains standing. The task is to simulate the final state of the dominoes after all the forces are applied.

Leetcode 844: Backspace String Compare

You are given an integer array arr. A mountain array is an array where the elements first strictly increase to a peak and then strictly decrease after that peak. Your task is to find the length of the longest mountain subarray in the given array. If no such subarray exists, return 0.

Leetcode 845: Longest Mountain in Array

Given an integer array arr, you need to find the length of the longest subarray that forms a mountain. A mountain subarray has the following properties: it must have at least three elements, the elements strictly increase to a peak, and then strictly decrease after the peak. If no such subarray exists, return 0.