识别信号
- Watch for off-by-one errors in row traversal during zigzag simulation.
- Check whether candidate handles single-row or short strings correctly.
- Clarifies how whitespace and signs are handled before digit accumulation.
解题流程
- 1. 明确窗口/状态定义
- 2. 更新状态并维护约束
- 3. 用边界样例验证
常见失分点
- Forgetting to reverse direction when reaching top or bottom row, breaking the zigzag pattern.
- Failing to skip leading spaces before detecting the sign.
- Attempting direct recursion without memoization can lead to stack overflow or repeated work.
推荐题单梯度
Z 字形变换
Convert a string into a zigzag pattern across multiple rows and read it line by line efficiently for string manipulation…
字符串转换整数 (atoi)
Convert a string to a 32-bit signed integer by carefully parsing characters, handling signs, and ignoring invalid traili…
外观数列
Count and Say requires building the nth sequence term by iteratively applying a run-length encoding on strings of digits…
最后一个单词的长度
Determine the length of the last word in a string using a focused string-driven approach to handle spaces and trailing c…
有效数字
Determine if a given string represents a valid number using precise string parsing and character validation rules.
字符串中的单词数
Count the segments of non-space characters in a string by applying a string-driven approach to solve the problem.
验证IP地址
Determine whether a given string is a valid IPv4 or IPv6 address using a precise string-driven validation strategy.
密钥格式化
Reformat a license key string by splitting into groups of size k, converting to uppercase, and handling dashes appropria…
检测大写字母
Detect Capital asks you to determine if a word follows a correct capital usage pattern based on specific rules.
最长特殊序列 Ⅰ
Determine the length of the longest uncommon subsequence between two strings using a direct string comparison strategy.
学生出勤记录 I
Determine if a student's attendance record qualifies for an award based on specific criteria for absences and lateness.
转换成小写字母
The "To Lower Case" problem asks you to convert all uppercase letters in a string to lowercase.
山羊拉丁文
Convert a sentence to Goat Latin by transforming each word based on vowel rules and incremental suffixes efficiently.
较大分组的位置
Identify and return intervals of consecutive, large character groups in a string of lowercase letters.
隐藏个人信息
This problem requires masking sensitive parts of emails and phone numbers using a precise string-driven strategy efficie…
Bigram 分词
Extract the third word in every adjacent triple of words matching a given bigram pattern from a text.
IP 地址无效化
Transform an IPv4 address by replacing each period with '[.]', focusing on a string-driven, direct manipulation approach…
解码字母到整数映射
Decrypt a string using alphabet-to-integer mapping, considering the presence of '#' as a special delimiter.
生成每种字符都是奇数个的字符串
Generate a string of n characters where each character appears an odd number of times, using a string-driven approach.
重新格式化字符串
Reformat The String involves rearranging alphanumeric characters in a string so that no adjacent characters have the sam…
连续字符
Find the power of a string by determining the length of its longest substring with a unique character.
转变日期格式
Reformat Date requires transforming a date string from human-readable form to YYYY-MM-DD using a string-driven strategy …
千位分隔数
Convert a given integer into a string with dots as thousand separators using a precise string-driven strategy.
替换所有的问号
Solve LeetCode 1576 by scanning left to right and replacing each ? with a letter different from its neighbors.
重新排列单词间的空格
Rearrange spaces between words by distributing them evenly, placing any leftover spaces at the end to match original tex…
设计 Goal 解析器
Interpret the Goal Parser's output by analyzing a command string containing 'G', '()', and '(al)' patterns.
重新格式化电话号码
Reformat a phone number by removing spaces and dashes, grouping digits into blocks of 3 or 2, and joining them with dash…
生成交替二进制字符串的最少操作数
Find the minimum number of changes required to convert a string into an alternating binary string.
检查二进制字符串字段
Check if a binary string contains at most one contiguous segment of ones.
将所有数字用字符替换
Transform a string by replacing digits at odd indices using the preceding character with a shift operation for accurate …
哪种连续子字符串更长
Determine if the longest segment of 1s in a binary string is strictly longer than the longest segment of 0s.
检查某单词是否等于两单词之和
Check if the sum of two word values equals a target word's value by converting letters to their numeric representations.
删除字符使字符串变好
This problem asks to remove the minimum number of characters from a string to ensure no three consecutive characters are…
检查句子中的数字是否递增
Check if the numbers in a sentence are strictly increasing from left to right using string tokenization.
句子中的有效单词数
Count all valid words in a sentence by analyzing each token with precise string-driven validation rules efficiently.
检查是否所有 A 都在 B 之前
Determine if all 'a's in a string appear before any 'b's using a direct string-driven check strategy for clarity and cor…
将标题首字母大写
Capitalize the Title requires transforming each word based on length, applying uppercase and lowercase rules precisely p…
Excel 表中某个范围内的单元格
This problem requires extracting a range of cells from an Excel-like sheet based on a string input and returning them in…
字符串中最大的 3 位相同数字
Find the largest 3-same-digit number within a string of digits using a string-driven solution approach.
字母在字符串中的百分比
Calculate the percentage of a specific letter in a string using a direct string-driven counting approach, rounding down …
价格减免
Apply Discount to Prices involves updating a sentence by applying a percentage discount to price words, with precise for…
强密码检验器 II
Check if a given password meets all strength requirements, including length, character types, and no adjacent repeated c…
统计星号
The 'Count Asterisks' problem asks you to count '*' excluding those between pairs of '|' in a string.
最长的字母序连续子字符串的长度
Find the length of the longest continuous alphabetical substring from a given string of lowercase letters.
回环句
Determine if a sentence is circular by verifying each word's last character matches the next word's first character effi…
最长平衡子字符串
Find the longest balanced substring of a binary string where zeroes precede ones and counts of each are equal.
移除字符串中的尾随零
Remove trailing zeros from a string representing a positive integer number.
判断通过操作能否让字符串相等 I
Determine if two strings can be made equal by repeatedly swapping characters at any two indices in each string.
使二进制字符串变美丽的最少修改次数
This problem involves determining the minimum number of changes to make a binary string beautiful using string-driven st…
使三个字符串相等
Determine the minimum number of operations to make three strings equal by removing rightmost characters from one string …
按键变更的次数
Count how many times a user switches keys in a typed string, ignoring shift and caps lock variations in characters.
字符串的分数
Calculate the sum of absolute ASCII differences between adjacent characters to score any given string efficiently.
有效单词
Determine if a given string qualifies as a valid word using a string-driven solution pattern with explicit character rul…
压缩字符串 III
Compress a string by repeatedly taking maximal same-character prefixes, following a string-driven solution strategy effi…
找出加密后的字符串
In this problem, you need to encrypt a string by shifting each character's position based on a given integer value.
找到初始输入字符串 I
Determine the length of the original string Alice intended to type by analyzing repeated characters and clumsy key press…
检查平衡字符串
Determine if a numeric string is balanced by comparing sums of digits at even and odd positions efficiently.
找出长度为 K 的特殊子字符串
Check efficiently if a string contains a consecutive sequence of length k where all characters match exactly one distinc…