摘要:
Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. You must write an algorithm that runs in O(n) time and 阅读全文
摘要:
You are given a string s and a robot that currently holds an empty string t. Apply one of the following operations until s and t are both empty: Remov 阅读全文
摘要:
You are given a string word, and an integer numFriends. Alice is organizing a game for her numFriends friends. There are multiple rounds in the game, 阅读全文
摘要:
You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle. A triangle is called equilateral if it has all sides of 阅读全文
摘要:
You are given a 0-indexed integer array nums. Return the maximum value over all triplets of indices (i, j, k) such that i < j < k. If all such triplet 阅读全文
摘要:
An element x of an integer array arr of length m is dominant if more than half the elements of arr have a value of x. You are given a 0-indexed intege 阅读全文
摘要:
You are given a 2D integer grid of size m x n and an integer x. In one operation, you can add x to or subtract x from any element in the grid. A uni-v 阅读全文
摘要:
You are given a 0-indexed binary string s of length n on which you can apply two types of operations: Choose an index i and invert all characters from 阅读全文
摘要:
You are given a binary array nums. You can do the following operation on the array any number of times (possibly zero): Choose any 3 consecutive eleme 阅读全文
摘要:
You are given an integer array nums. You need to create a 2D array from nums satisfying the following conditions: The 2D array should contain only the 阅读全文
摘要:
You are given an array nums consisting of positive integers. We call a subarray of nums nice if the bitwise AND of every pair of elements that are in 阅读全文
摘要:
You are given a 0-indexed integer array candies. Each element in the array denotes a pile of candies of size candies[i]. You can divide each pile into 阅读全文
摘要:
You are given a binary array nums. We call a subarray alternating if no two adjacent elements in the subarray have the same value. Return the number o 阅读全文
摘要:
There is a circle of red and blue tiles. You are given an array of integers colors and an integer k. The color of tile i is represented by colors[i]: 阅读全文
摘要:
The k-beauty of an integer num is defined as the number of substrings of num when it is read as a string that meet the following conditions: It has a 阅读全文
摘要:
You are given a 0-indexed integer array nums. In one operation, you can: Choose two different indices i and j such that 0 <= i, j < nums.length. Choos 阅读全文
摘要:
You are given a 0-indexed string array words. Two strings are similar if they consist of the same characters. For example, "abca" and "cba" are simila 阅读全文
摘要:
You are given a 0-indexed 2D matrix grid of size m x n, where (r, c) represents: A land cell if grid[r][c] = 0, or A water cell containing grid[r][c] 阅读全文
摘要:
You are given a 0-indexed array nums consisting of positive integers. You can choose two indices i and j, such that i != j, and the sum of digits of t 阅读全文
摘要:
You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i < j and j - i != nums[j] - nums[i]. Return the total number 阅读全文