题库chevron_right分类chevron_right计数
pin

计数

149 道题目
简单: 56中等: 77困难: 16

计数 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

题库

计数 题库

先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。

慢加载专题题库

适合这类题很多的专题,先扫结构,再逐步深入。

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 149 道题目

每次续载 24 题
#题目难度
169

多数元素

Find the majority element in an array, where the element appears more than n/2 times, using efficient algorithms.

简单
229

多数元素 II

Identify all elements in an integer array appearing more than ⌊ n/3 ⌋ times using efficient array scanning and hash coun…

中等
299

猜数字游戏

Solve the Bulls and Cows problem using hash tables and string manipulation to track exact and misplaced digits.

中等
347

前 K 个高频元素

Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.

中等
383

赎金信

Determine if a ransom note can be constructed from a magazine's letters using hash tables and string counting techniques…

简单
387

字符串中的第一个唯一字符

Find the index of the first non-repeating character in a string using efficient queue-driven state processing.

简单
451

根据字符出现频率排序

Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…

中等
594

最长和谐子序列

Find the length of the longest harmonious subsequence in an integer array using array scanning and hash-based frequency …

简单
621

任务调度器

Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…

中等
692

前K个高频单词

Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…

中等
767

重构字符串

Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.

中等
811

子域名访问计数

The Subdomain Visit Count problem requires counting the visits to all subdomains of a given domain from a list of count-…

中等
819

最常见的单词

Find the most frequent non-banned word in a paragraph, excluding punctuation, using an efficient array scan and hash tab…

简单
869

重新排序得到 2 的幂

Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.

中等
884

两句话中的不常见单词

Find uncommon words from two sentences by counting word frequencies using hash tables.

简单
900

RLE 迭代器

Design an efficient iterator for a run-length encoded array, handling large counts and sequential access correctly every…

中等
914

卡牌分组

Solve the problem of determining if a deck can be partitioned into groups with equal occurrences of card values.

简单
923

三数之和的多种可能

Count all unique triplets in an integer array whose sum equals the target, handling multiplicity efficiently using hashi…

中等
945

使数组唯一的最小增量

This problem challenges you to find the minimum moves to make all elements in an array unique by incrementing elements.

中等
992

K 个不同整数的子数组

Find subarrays with exactly k distinct integers in an integer array using sliding window and hash lookup techniques.

困难
1010

总持续时间可被 60 整除的歌曲

Calculate the number of song pairs whose total durations sum to a multiple of 60 using array scanning and hash lookups.

中等
1054

距离相等的条形码

Rearrange barcodes in an array so that no two adjacent elements are equal, using a greedy approach and hash table for ef…

中等
1079

活字印刷

Compute all unique non-empty sequences from given letter tiles using backtracking search with pruning efficiently.

中等
1090

受标签影响的最大值

Maximize the sum of selected item values while respecting label use limits using array scanning and hash tracking.

中等

swap_vert在题库框内继续向下滚动,也会自动续载

关联高频模式

LeetCode 计数题型题解:149题训练路线