摘要:problem 892. Surface Area of 3D Shapes solution#1: code 注意,不是简单的投影面积的2倍; 参考 1. leetcode_easy_math_892. Surface Area of 3D Shapes; 2. Grandyang; 完
阅读全文
摘要:problem 1636. Sort Array by Increasing Frequency solution#1: sort code 注意: 1. sort的用法,特别是第三个参数的使用; 2. lamda函数; 参考 1. leetcode_easy_array_1636. Sort Ar
阅读全文
摘要:problem 1640. Check Array Formation Through Concatenation solution#1: code 参考 1. leetcode_easy_array_1640. Check Array Formation Through Concatenation
阅读全文
摘要:problem 942. DI String Match solution#1: code 参考 1. leetcode_easy_math_942. DI String Match; 2. Grandyang; 完
阅读全文
摘要:problem 1281. Subtract the Product and Sum of Digits of an Integer solution#1: code 参考 1. leetcode_easy_math_1281. Subtract the Product and Sum of Dig
阅读全文
摘要:problem 1237. Find Positive Integer Solution for a Given Equation solution#1: two loop; code solution#2: binary search; code 参考 1. leetcode_easy_math_
阅读全文
摘要:problem 1317. Convert Integer to the Sum of Two No-Zero Integers solution#1:检查数值中是否含有字符0; code: solution#2: 通过判断除以10的余数来判断是否含有符号0; code: 注意,理解题目的意思,要求
阅读全文
摘要:problem 1175. Prime Arrangements solution#1: 根据数值的范围直接给出范围内的素数进行计算; code solution#2: 求解素数的个数,然后求解素数和非素数的阶乘之积。 code: 注意1,两个int类型的数据相乘之后的数据范围及类型; 注意2,数据
阅读全文
摘要:problem 1523. Count Odd Numbers in an Interval Range solution#1: 分别计算0到low-1和0到high的奇数数目,然后做差即可。 code solution#2:根绝high和low的奇偶性判断。 code 参考 1. leetcode
阅读全文
摘要:problem 1025. Divisor Game solution#1: code 参考 1. leetcode_easy_math_1025. Divisor Game; 2. LeetCode.1025-除数游戏(Divisor Game); 3. 1025. 除数博弈(Divisor Ga
阅读全文
摘要:problem 1009. Complement of Base 10 Integer solution#1:XOR. code 参考 1. leetcode_easy_math_1009. Complement of Base 10 Integer; 完
阅读全文
摘要:problem 606. Construct String from Binary Tree solution#1: 使用原函数递归; code solution#2: 使用额外函数递归; code 参考 1. leetcode_easy_string_606. Construct String f
阅读全文
摘要:problem 1332. Remove Palindromic Subsequences solution#1:判断是否为回文; code solution#2:在主要函数中直接判断回文; code solution#3:使用string的rbegin/rend特性; code 注意,不明白为什么
阅读全文
摘要:problem 1309. Decrypt String from Alphabet to Integer Mapping solution#1:将问题分为两部分进行判断; code 参考 1. leetcode_easy_string_1309. Decrypt String from Alpha
阅读全文
摘要:problem 1221. Split a String in Balanced Strings solution#1: 括号匹配问题; code 参考 1. leetcode_easy_string_1221. Split a String in Balanced Strings; 2. 【Lee
阅读全文
摘要:problem 1417. Reformat The String solution#1: code class Solution { public: string reformat(string s) { string res = ""; string digits = ""; string le
阅读全文
摘要:problem 1374. Generate a String With Characters That Have Odd Counts solution#1: code solution#2: one line; code 参考 1. leetcode_easy_string_1374. Gene
阅读全文
摘要:problem 1370. Increasing Decreasing String 理解题意; solution#1: code 参考 1. leetcode_easy_string_1370. Increasing Decreasing String; 完
阅读全文
摘要:problem 1422. Maximum Score After Splitting a String solution#1: code class Solution { public: int maxScore(string s) { int left = 0, right = 0; for(a
阅读全文
摘要:problem 1507. Reformat Date solution#1: 使用map;使用函数; code: class Solution { public: unordered_map<string, string> months = {{"Jan", "01"}, {"Feb", "02"
阅读全文