All Posts

Leetcode 2068: Check Whether Two Strings are Almost Equivalent

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.

Leetcode 2073: Time Needed to Buy Tickets

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.

Leetcode 2099: Find Subsequence of Length K With the Largest Sum

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.

Leetcode 2108: Find First Palindromic String in the Array

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.

Leetcode 2124: Check if All A's Appears Before All B's

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.

Leetcode 2129: Capitalize the Title

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.