原文链接: https://leetcode-cn.com/problems/department-highest-salary 英文原文Table: Employee +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +--------------+…
分类详情
中等 分类
原文链接: https://leetcode-cn.com/problems/repeated-dna-sequences 英文原文The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When studying DNA, it is useful to identify …
原文链接: https://leetcode-cn.com/problems/rotate-array 英文原文Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the righ…
原文链接: https://leetcode-cn.com/problems/transpose-file 英文原文Given a text file file.txt, transpose its content. You may assume that each row has the same number of columns, and each field is separated by the ' ' character. Example: If file.txt has the f…
原文链接: https://leetcode-cn.com/problems/house-robber 英文原文You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent…
原文链接: https://leetcode-cn.com/problems/binary-tree-right-side-view 英文原文Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 1: Input: root =…
原文链接: https://leetcode-cn.com/problems/number-of-islands 英文原文Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacen…
原文链接: https://leetcode-cn.com/problems/bitwise-and-of-numbers-range 英文原文Given two integers left and right that represent the range [left, right], return the bitwise AND of all numbers in this range, inclusive. Example 1: Input: left = 5, right = 7 Ou…
原文链接: https://leetcode-cn.com/problems/count-primes 英文原文Given an integer n, return the number of prime numbers that are strictly less than n. Example 1: Input: n = 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.…
原文链接: https://leetcode-cn.com/problems/course-schedule 英文原文There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take…
原文链接: https://leetcode-cn.com/problems/implement-trie-prefix-tree 英文原文A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this dat…
原文链接: https://leetcode-cn.com/problems/minimum-size-subarray-sum 英文原文Given an array of positive integers nums and a positive integer target, return the minimal length of a contiguous subarray [numsl, numsl+1, ..., numsr-1, numsr] of which the sum is …
原文链接: https://leetcode-cn.com/problems/course-schedule-ii 英文原文There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must t…
原文链接: https://leetcode-cn.com/problems/design-add-and-search-words-data-structure 英文原文Design a data structure that supports adding new words and finding if a string matches any previously added string. Implement the WordDictionary class: WordDictiona…
原文链接: https://leetcode-cn.com/problems/house-robber-ii 英文原文You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first …
原文链接: https://leetcode-cn.com/problems/kth-largest-element-in-an-array 英文原文Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct el…
原文链接: https://leetcode-cn.com/problems/combination-sum-iii 英文原文Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 through 9 are used. Each number is used at most once. Return a list o…
原文链接: https://leetcode-cn.com/problems/contains-duplicate-iii 英文原文Given an integer array nums and two integers k and t, return true if there are two distinct indices i and j in the array such that abs(nums[i] - nums[j]) <= t and abs(i - j) <= k. Exam…
原文链接: https://leetcode-cn.com/problems/maximal-square 英文原文Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example 1: Input: matrix = [["1","0","1","0","0"],["1","0","1","1","1"],[…
原文链接: https://leetcode-cn.com/problems/count-complete-tree-nodes 英文原文Given the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia, every level, except possibly the last, is completely filled in a comple…
原文链接: https://leetcode-cn.com/problems/rectangle-area 英文原文Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. The first rectangle is defined by its bottom-left corner (ax1, ay1) and …
原文链接: https://leetcode-cn.com/problems/basic-calculator-ii 英文原文Given a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero. You may assume that the given expression …
原文链接: https://leetcode-cn.com/problems/majority-element-ii 英文原文Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. Example 1: Input: nums = [3,2,3] Output: [3] Example 2: Input: nums = [1] Output: [1…
原文链接: https://leetcode-cn.com/problems/kth-smallest-element-in-a-bst 英文原文Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. Example 1: Input: root = [3,1,4,n…
原文链接: https://leetcode-cn.com/problems/product-of-array-except-self 英文原文Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. The product of any prefix or suffix of…
原文链接: https://leetcode-cn.com/problems/different-ways-to-add-parentheses 英文原文Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return…
原文链接: https://leetcode-cn.com/problems/search-a-2d-matrix-ii 英文原文Write an efficient algorithm that searches for a target value in an m x n integer matrix. The matrix has the following properties: Integers in each row are sorted in ascending from left…
原文链接: https://leetcode-cn.com/problems/single-number-iii 英文原文Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the …
原文链接: https://leetcode-cn.com/problems/ugly-number-ii 英文原文An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return the nth ugly number. Example 1: Input: n = 10 Output: 12 Explanation: [1, 2, 3, …
原文链接: https://leetcode-cn.com/problems/h-index 英文原文Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return compute the researcher's h-index. According to the definition of h…