All Posts

Leetcode 1419: Minimum Number of Frogs Croaking

You are given a string croakOfFrogs, which represents a mix of sounds from multiple frogs croaking the word ‘croak’. Each frog croaks the sequence of letters: ‘c’, ‘r’, ‘o’, ‘a’, ‘k’. Your task is to determine the minimum number of frogs needed to croak all the sounds in the string, while following the correct letter sequence. If the string is not a valid combination of croaks, return -1.

Leetcode 1422: Maximum Score After Splitting a String

You are given a binary string s consisting of characters ‘0’ and ‘1’. Your task is to split the string into two non-empty substrings (a left substring and a right substring) and return the maximum score that can be achieved by splitting the string. The score is the sum of the number of ‘0’s in the left substring and the number of ‘1’s in the right substring. Find the maximum score by evaluating all possible splits.

Leetcode 1433: Check If a String Can Break Another String

You are given two strings s1 and s2 of the same length. You need to check if some permutation of s1 can ‘break’ some permutation of s2, or vice-versa. A string x can break string y if for every character at position i, x[i] >= y[i] when sorted alphabetically.

Leetcode 1436: Destination City

You are given an array paths where each element represents a pair of cities [cityAi, cityBi], indicating a direct route from cityAi to cityBi. Your task is to find the destination city, which is the city without any outgoing path to another city.

Leetcode 1447: Simplified Fractions

Given an integer n, return a list of all unique simplified fractions between 0 and 1 (exclusive) where the denominator is less than or equal to n. A fraction is simplified if the greatest common divisor (GCD) of the numerator and denominator is 1. The result can be returned in any order.

Leetcode 1451: Rearrange Words in a Sentence

Given a sentence consisting of space-separated words, rearrange the words in the sentence such that they are ordered by increasing length. Words with the same length should retain their original order. The first word of the rearranged sentence must start with a capital letter, and all other words must be in lowercase.