Leetcode-cn.com 2022-03-03
🟢 258.add-digits
🏷️ Tags
#math #number_theory #simulation
Description
给定一个非负整数
Example
🟢 258.add-digits
🏷️ Tags
#math #number_theory #simulation
Description
给定一个非负整数
num,反复将各个位上的数字相加,直到结果为一位数。返回这个结果。Example
输入: num = 38
输出: 2
解释: 各位相加的过程为:
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
由于 2 是一位数,所以返回 2。
1799.maximize-score-after-n-operations.pdf
74.8 KB
leetcode.cn 2022-12-22
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
1819.number-of-different-subsequences-gcds.pdf
83.5 KB
leetcode.cn 2023-01-14
🔴1819.number-of-different-subsequences-gcds
🏷️ Tags
#array #math #counting #number_theory
🔴1819.number-of-different-subsequences-gcds
🏷️ Tags
#array #math #counting #number_theory
leetcode.com 2023-05-14
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
🔴1799.maximize-score-after-n-operations
🏷️ Tags
#bit_manipulation #array #math #dynamic_programming #backtracking #bitmask #number_theory
Telegraph
maximize-score-after-n-operations
You are given nums, an array of positive integers of size 2 * n. You must perform n operations on this array. In the ith operation (1-indexed), you will:
leetcode.cn 2024-01-06
🟡2807.insert-greatest-common-divisors-in-linked-list
🏷️ Tags
#linked_list #math #number_theory
🟡2807.insert-greatest-common-divisors-in-linked-list
🏷️ Tags
#linked_list #math #number_theory
Telegraph
insert-greatest-common-divisors-in-linked-list
给你一个链表的头 head ,每个结点包含一个整数值。 在相邻结点之间,请你插入一个新的结点,结点值为这两个相邻结点值的 最大公约数 。 请你返回插入之后的链表。 两个数的 最大公约数 是可以被两个数字整除的最大正整数。 示例 1: 输入:head = [18,6,10,3] 输出:[18,6,6,2,10,1,3] 解释:第一幅图是一开始的链表,第二幅图是插入新结点后的图(蓝色结点为新插入结点)。 - 18 和 6 的最大公约数为 6 ,插入第一和第二个结点之间。 - 6 和 10 的最大公约数为…
👍1
leetcode.com 2025-03-29
🔴2818.apply-operations-to-maximize-score
🏷️ Tags
#stack #greedy #array #math #number_theory #sorting #monotonic_stack
🔴2818.apply-operations-to-maximize-score
🏷️ Tags
#stack #greedy #array #math #number_theory #sorting #monotonic_stack
Telegraph
apply-operations-to-maximize-score
You are given an array nums of n positive integers and an integer k. Initially, you start with a score of 1. You have to maximize your score by applying the following operation at most k times:
leetcode.cn 2025-04-22
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
Telegraph
count-the-number-of-ideal-arrays
给你两个整数 n 和 maxValue ,用于描述一个 理想数组 。 对于下标从 0 开始、长度为 n 的整数数组 arr ,如果满足以下条件,则认为该数组是一个 理想数组 :
leetcode.com 2025-04-22
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
🔴2338.count-the-number-of-ideal-arrays
🏷️ Tags
#math #dynamic_programming #combinatorics #number_theory
Telegraph
count-the-number-of-ideal-arrays
You are given two integers n and maxValue, which are used to describe an ideal array. A 0-indexed integer array arr of length n is considered ideal if the following conditions hold:
leetcode.cn 2025-09-16
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
Telegraph
replace-non-coprime-numbers-in-array
给你一个整数数组 nums 。请你对数组执行下述操作:
leetcode.com 2025-09-16
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
🔴2197.replace-non-coprime-numbers-in-array
🏷️ Tags
#stack #array #math #number_theory
Telegraph
replace-non-coprime-numbers-in-array
You are given an array of integers nums. Perform the following steps:
leetcode.cn 2025-10-23
🟢3461.check-if-digits-are-equal-in-string-after-operations-i
🏷️ Tags
#math #string #combinatorics #number_theory #simulation
🟢3461.check-if-digits-are-equal-in-string-after-operations-i
🏷️ Tags
#math #string #combinatorics #number_theory #simulation
Telegraph
check-if-digits-are-equal-in-string-after-operations-i
给你一个由数字组成的字符串 s 。重复执行以下操作,直到字符串恰好包含 两个 数字:
leetcode.com 2025-10-23
🟢3461.check-if-digits-are-equal-in-string-after-operations-i
🏷️ Tags
#math #string #combinatorics #number_theory #simulation
🟢3461.check-if-digits-are-equal-in-string-after-operations-i
🏷️ Tags
#math #string #combinatorics #number_theory #simulation
Telegraph
check-if-digits-are-equal-in-string-after-operations-i
You are given a string s consisting of digits. Perform the following operation repeatedly until the string has exactly two digits:
❤1
leetcode.cn 2025-11-12
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
Telegraph
minimum-number-of-operations-to-make-all-array-elements-equal-to-1
给你一个下标从 0 开始的 正 整数数组 nums 。你可以对数组执行以下操作 任意 次:
leetcode.com 2025-11-12
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
🟡2654.minimum-number-of-operations-to-make-all-array-elements-equal-to-1
🏷️ Tags
#array #math #number_theory
Telegraph
minimum-number-of-operations-to-make-all-array-elements-equal-to-1
You are given a 0-indexed array nums consisiting of positive integers. You can do the following operation on the array any number of times: