670. Maximum Swap
You are given an integer num. You can swap two digits at most once to get the maximum valued number. Return the […]
You are given an integer num. You can swap two digits at most once to get the maximum valued number. Return the […]
A string s is called happy if it satisfies the following conditions: s only contains the letters ‘a’, ‘b’, and ‘c’. s does not contain any of “aaa”, “bbb”, or “ccc” as a
There are n balls on a table, each ball has a color black or white. You are given a 0-indexed binary string s of length n, where 1 and 0 represent
You are given a 0-indexed integer array nums and an integer k. You have a starting score of 0. In one operation: choose an index i such that 0 <= i <
You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists. We define
You are given a 2D integer array intervals where intervals[i] = [lefti, righti] represents the inclusive interval [lefti, righti]. You have to divide the intervals into one
There is a party where n friends numbered from 0 to n – 1 are attending. There is an infinite number of chairs in this party that are
A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j – i. Given
A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B),
You are given a 0-indexed string s of even length n. The string consists of exactly n / 2 opening brackets ‘[‘ and n / 2 closing brackets ‘]’. A string is called balanced if and only
You are given a string s consisting only of uppercase English letters. You can apply some operations to this string where, in one operation,
You are given two strings sentence1 and sentence2, each representing a sentence composed of words. A sentence is a list of words that are separated by a single space