摘要:
Given an array of integers arr, and three integers a, b and c. You need to find the number of good triplets. A triplet (arr[i], arr[j], arr[k]) is goo 阅读全文
摘要:
Given a 0-indexed integer array nums, return the number of distinct quadruplets (a, b, c, d) such that: nums[a] + nums[b] + nums[c] == nums[d], and a 阅读全文
摘要:
Design a max stack data structure that supports the stack operations and supports finding the stack's maximum element. Implement the MaxStack class: M 阅读全文
摘要:
You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times: Pick 阅读全文
摘要:
You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a di 阅读全文
摘要:
There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t 阅读全文
摘要:
There are n houses evenly lined up on the street, and each house is beautifully painted. You are given a 0-indexed integer array colors of length n, w 阅读全文
摘要:
Given a 0-indexed integer array nums of size n, find the maximum difference between nums[i] and nums[j] (i.e., nums[j] - nums[i]), such that 0 <= i < 阅读全文
摘要:
You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different 阅读全文
摘要:
You are given an array nums of n positive integers. You can perform two types of operations on any element of the array any number of times: If the el 阅读全文
摘要:
We have two special characters: The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). G 阅读全文
摘要:
You are given two integers, x and y, which represent your current location on a Cartesian grid: (x, y). You are also given an array points where each 阅读全文
摘要:
Given an integer n, return a list of all simplified fractions between 0 and 1 (exclusive) such that the denominator is less-than-or-equal-to n. You ca 阅读全文
摘要:
You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding t 阅读全文
摘要:
Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). Example 1: Input: low = 3, high = 7 Ou 阅读全文
摘要:
Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of 阅读全文
摘要:
You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array. Return the sum of all the 阅读全文
摘要:
You are given an array rectangles where rectangles[i] = [li, wi] represents the ith rectangle of length li and width wi. You can cut the ith rectangle 阅读全文
摘要:
A string s is nice if, for every letter of the alphabet that s contains, it appears both in uppercase and lowercase. For example, "abABB" is nice beca 阅读全文
摘要:
You are playing a game that contains multiple characters, and each of the characters has two main properties: attack and defense. You are given a 2D i 阅读全文