原文链接: 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/consecutive-numbers-sum 英文原文Given an integer n, return the number of ways you can write n as the sum of consecutive positive integers. Example 1: Input: n = 5 Output: 2 Explanation: 5 = 2 + 3 Example 2: Input: n…
原文链接: https://leetcode-cn.com/problems/longest-mountain-in-array 英文原文You may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some index i (0-indexed) with 0 < i < arr.length - 1 such that: arr[0] < arr[1] < .…
原文链接: https://leetcode-cn.com/problems/reordered-power-of-2 英文原文You are given an integer n. We reorder the digits in any order (including the original order) such that the leading digit is not zero. Return true if and only if we can do this so that t…
原文链接: https://leetcode-cn.com/problems/super-palindromes 英文原文Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome. Given two positive integers left and right represented as strings, retur…
原文链接: https://leetcode-cn.com/problems/largest-time-for-given-digits 英文原文Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once. 24-hour times are formatted as "HH:MM", where HH is between 00 and 2…
原文链接: https://leetcode-cn.com/problems/sequential-digits 英文原文An integer has sequential digits if and only if each digit in the number is one more than the previous digit. Return a sorted list of all the integers in the range [low, high] inclusive tha…
原文链接: https://leetcode-cn.com/problems/detect-pattern-of-length-m-repeated-k-or-more-times 英文原文Given an array of positive integers arr, find a pattern of length m that is repeated k or more times. A pattern is a subarray (consecutive sub-sequence) th…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-achievable-transfer-requests 英文原文We have n buildings numbered from 0 to n - 1. Each building has a number of employees. It's transfer season, and some employees want to change the building they…
原文链接: https://leetcode-cn.com/problems/coordinate-with-maximum-network-quality 英文原文You are given an array of network towers towers, where towers[i] = [xi, yi, qi] denotes the ith network tower with location (xi, yi) and quality factor qi. All the coo…
原文链接: https://leetcode-cn.com/problems/count-subtrees-with-max-distance-between-cities 英文原文There are n cities numbered from 1 to n. You are given an array edges of size n-1, where edges[i] = [ui, vi] represents a bidirectional edge between cities ui …
原文链接: https://leetcode-cn.com/problems/count-square-sum-triples 英文原文A square triple (a,b,c) is a triple where a, b, and c are integers and a2 + b2 = c2. Given an integer n, return the number of square triples such that 1 <= a, b, c <= n. Example 1: I…
原文链接: https://leetcode-cn.com/problems/check-if-move-is-legal 英文原文You are given a 0-indexed 8 x 8 grid board, where board[r][c] represents the cell (r, c) on a game board. On the board, free cells are represented by '.', white cells are represented b…
原文链接: https://leetcode-cn.com/problems/count-special-quadruplets 英文原文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 < b < c < d Example 1: Input: n…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-ways-to-partition-an-array 英文原文You are given a 0-indexed integer array nums of length n. The number of ways to partition nums is the number of pivot indices that satisfy both conditions: 1 <= p…
原文链接: https://leetcode-cn.com/problems/longest-subsequence-repeated-k-times 英文原文You are given a string s of length n, and an integer k. You are tasked to find the longest subsequence repeated k times in string s. A subsequence is a string that can be…
原文链接: https://leetcode-cn.com/problems/check-if-word-can-be-placed-in-crossword 英文原文You are given an m x n matrix board, representing the current state of a crossword puzzle. The crossword contains lowercase English letters (from solved words), ' ' t…
原文链接: https://leetcode-cn.com/problems/next-greater-numerically-balanced-number 英文原文An integer x is numerically balanced if for every digit d in the number x, there are exactly d occurrences of that digit in x. Given an integer n, return the smallest…
原文链接: https://leetcode-cn.com/problems/sum-of-k-mirror-numbers 英文原文A k-mirror number is a positive integer without leading zeros that reads the same both forward and backward in base-10 as well as in base-k. For example, 9 is a 2-mirror number. The r…
原文链接: https://leetcode-cn.com/problems/he-wei-sde-lian-xu-zheng-shu-xu-lie-lcof 中文题目输入一个正整数 target ,输出所有和为 target 的连续正整数序列(至少含有两个数)。 序列内的数字由小到大排列,不同序列按照首个数字从小到大排列。 示例 1: 输入:target = 9 输出:[[2,3,4],[4,5]] 示例 2: 输入:target = 15 输出:[[1,2,3,4,5],[4,5,6],[7…
原文链接: https://leetcode-cn.com/problems/pattern-matching-lcci 英文原文You are given two strings, pattern and value. The pattern string consists of just the letters a and b, describing a pattern within a string. For example, the string catcatgocatgo matche…
原文链接: https://leetcode-cn.com/problems/fsa7oZ 英文原文 中文题目小力正在通过残局练习来备战「力扣挑战赛」中的「五子棋」项目,他想请你能帮他预测当前残局的输赢情况。棋盘中的棋子分布信息记录于二维数组 `pieces` 中,其中 `pieces[i] = [x,y,color]` 表示第 `i` 枚棋子的横坐标为 `x`,纵坐标为 `y`,棋子颜色为 `color`(`0` 表示黑棋,`1` 表示白棋)。假如黑棋先行,并且黑棋和白棋都按最优策略落子,请你…