题库chevron_right解题模式chevron_right数组·string
schema可复用解题模式

数组·string模式

模式页更适合建立可迁移的解题框架。先抓识别信号,再反复练状态定义、更新规则和边界解释,能比零散刷题更快形成稳定手感。

database49 道题tune24/18/7 难度梯度category6 个关联题型

模式摘要

先识别什么

题目里常出现可以复用的状态更新节奏。

解法节奏

先口述状态和不变量,再解释每一步如何更新,最后用反例验证边界。

高频失分点

状态定义说不清,写出来也难以稳定维护。

识别信号

  • 题目里常出现可以复用的状态更新节奏。
  • 暴力枚举太慢,但结构上存在可维护的不变量。
  • 面试追问通常会盯住边界、状态变更和复杂度。

解题流程

  1. 1. 明确窗口/状态定义
  2. 2. 更新状态并维护约束
  3. 3. 用边界样例验证

常见失分点

  • 状态定义说不清,写出来也难以稳定维护。
  • 只会背模板,解释不了为什么这样更新。
  • 样例能过,但边界和复杂度追问容易崩。

推荐题单梯度

题库

数组·string模式题库

这里更适合先按关键词或难度找题,再按关联题型切入。题库会在容器内继续滚动时慢慢续载,避免模式页被长列表一下子拉穿。

慢加载模式题库

适合先建模式理解,再扩展到完整题单。

hourglass_bottom容器内滚动续载
search
tune难度
category题型聚焦

当前展示 24 / 49 道题目

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

最长公共前缀

Find the longest common prefix in an array of strings, returning an empty string if none exists.

简单
68

文本左右对齐

Text Justification requires packing words into lines to match a specified width, ensuring even distribution of spaces.

困难
318

最大单词长度乘积

The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…

中等
722

删除注释

Remove comments from a given C++ program source array, handling line and block comments.

中等
806

写字符串需要的行数

Calculate how many lines are needed to write a string given individual letter widths, constrained to 100 pixels per line…

简单
848

字母移位

Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.

中等
937

重新排列日志文件

Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …

中等
944

删列造序

The 'Delete Columns to Make Sorted' problem asks to remove unsorted columns from a string array, ensuring all columns ar…

简单
990

等式方程的可满足性

Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…

中等
1032

字符流

Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…

困难
1233

删除子文件夹

Remove sub-folders in a filesystem by filtering out folders nested inside other folders.

中等
1324

竖直打印单词

Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…

中等
1408

数组中的字符串匹配

Identify all strings in an array that appear as substrings of other strings, focusing on array and string matching patte…

简单
1528

重新排列字符串

Reorder characters in a string using a given indices array to reconstruct the intended output efficiently and correctly.

简单
1629

按键持续时间最长的键

Determine which key had the longest press duration in a sequence using array indices and string mapping, resolving ties …

简单
1662

检查两个字符串数组是否相等

Determine if two string arrays form identical strings by concatenating elements in order, handling subtle array-length m…

简单
1769

移动所有球到每个盒子所需的最小操作数

Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…

中等
1773

统计匹配检索规则的物品数量

Count Items Matching a Rule is an easy problem that tests array and string manipulation with conditions based on specifi…

简单
1816

截断句子

Truncate a sentence to contain only the first k words by converting it into an array of words.

简单
1967

作为子字符串出现在单词中的字符串数目

Count how many strings in an array appear as substrings within a given word by checking each pattern individually.

简单
1985

找出数组中的第 K 大整数

This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…

中等
2011

执行操作后的变量值

Compute the final value of X by simulating each string operation in the array sequentially with careful tracking.

简单
2114

句子中的最多单词数

Find the maximum number of words in a single sentence from an array of sentences using array and string processing techn…

简单
2185

统计包含给定前缀的字符串

Count how many words in a list start with a given prefix.

简单

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

按题型继续深入

模式学会之后,最好回到具体题型里做迁移训练。这样更容易分清楚“模式本身”和“场景变化”分别在哪里。

route

引导式练习路径

AI 会按你的当前水平推荐题目,并持续记录练习进度。

开始引导练习arrow_forward
LeetCode 数组·string模式题解:49题训练路线