题库chevron_right数学·string

数学·string 模式

35 道题目

模式页适合用来建立可复用解题框架。先识别题目特征,再按固定流程解释状态定义、转移和边界。

识别信号

  • Check if the candidate handles carry propagation correctly in a digit-by-digit simulation.
  • Watch for attempts to convert strings directly to integers, which violates constraints.
  • Do you handle carry properly when adding binary digits?

解题流程

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

常见失分点

  • Failing to reverse the input strings before multiplying can misalign digits and produce incorrect results.
  • Ignoring the carry during addition can lead to incorrect results.
  • Forgetting to subtract 1 before modulo leads to incorrect letters for multiples of 26.

推荐题单梯度

#题目难度
43

字符串相乘

Multiply Strings requires simulating integer multiplication using only string operations without direct numeric conversi…

中等
67

二进制求和

Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…

简单
168

Excel 表列名称

Convert a positive integer to its corresponding Excel column title using base-26 math and string manipulation efficientl…

简单
171

Excel 表列序号

This problem requires converting an Excel column title into its corresponding column number by applying a math and strin…

简单
273

整数转换英文表示

Convert a given integer to its English words representation using mathematical logic and string manipulation.

困难
405

数字转换为十六进制数

Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.

简单
412

Fizz Buzz

Generate a list from 1 to n replacing multiples of 3 with Fizz, 5 with Buzz, and both with FizzBuzz efficiently.

简单
415

字符串相加

Given two non-negative integers as strings, sum them and return the result as a string without converting to integers di…

简单
504

七进制数

Convert any given integer to its base 7 string representation using efficient math and string manipulation techniques.

简单
537

复数乘法

This problem requires multiplying two complex numbers, given in string form, and returning the result in the same format…

中等
564

寻找最近的回文数

Identify the nearest palindrome to a given integer string, handling ties and large numbers efficiently using math and st…

困难
592

分数加减运算

Solve fraction addition and subtraction by handling expressions, calculating results, and simplifying fractions to irred…

中等
640

求解方程

Solve the equation for the variable 'x' and determine its value or state if there is no solution or infinite solutions.

中等
899

有序队列

Given a string and integer k, rearrange characters to achieve the lexicographically smallest string using limited rotati…

困难
906

超级回文数

Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.

困难
972

相等的有理数

Given two rational numbers as strings with possible repeating decimals, determine if they represent the same number.

困难
1041

困于环中的机器人

Determine if a robot following a repeated instruction sequence stays within a bounded circle using math and string simul…

中等
1071

字符串的最大公因子

Find the greatest common divisor string between two strings based on the math and string patterns.

简单
1154

一年中的第几天

Calculate the day number of the year based on a given Gregorian calendar date in the format YYYY-MM-DD.

简单
1360

日期之间隔几天

Calculate the exact number of days between two dates using string parsing and arithmetic logic with consistent accuracy.

简单
1447

最简分数

Generate simplified fractions between 0 and 1 with denominators up to a given integer n.

中等
1513

仅含 1 的子串数

Calculate the number of contiguous substrings containing only 1s in a binary string using a math and string approach eff…

中等
1573

分割字符串的方案数

Count the number of ways to split a binary string into three non-empty parts with equal numbers of '1's.

中等
1759

统计同质子字符串的数目

This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.

中等
1812

判断国际象棋棋盘中一个格子的颜色

Determine whether a given chessboard square is white or black by converting coordinates using a math plus string approac…

简单
1830

使字符串有序的最少操作次数

Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…

困难
1904

你完成的完整对局数

Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…

中等
2409

统计共同度过的日子数

Count the total number of days Alice and Bob are in Rome together, given their arrival and departure dates.

简单
3084

统计以给定字符开头和结尾的子字符串总数

Given a string and a character, find the total number of substrings that start and end with that character.

中等
3227

字符串元音游戏

Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…

中等
3274

检查棋盘方格颜色是否相同

Determine if two chessboard squares share the same color using coordinate math and simple string manipulation for quick …

简单
3280

将日期转换为二进制表示

Convert a given Gregorian date string to its binary format by transforming year, month, and day individually without lea…

简单
3461

判断操作后字符串中的数字是否相等 I

Simulate repeated adjacent digit sums modulo 10 until two digits remain, then check whether those final digits match.

简单
3463

判断操作后字符串中的数字是否相等 II

Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…

困难
3602

十六进制和三十六进制转化

Solve Hexadecimal and Hexatrigesimal Conversion by converting n squared to base 16 and n cubed to base 36, then joining …

简单

关联题型

LeetCode 数学·string模式题解:35题训练路线