摘要:problem 1436. Destination City solution#1: 使用map; code solution#2: 使用set; code 参考 1. leetcode_easy_string_1436. Destination City; 完
阅读全文
摘要:problem 1556. Thousand Separator solution#1: 使用to_string和迭代; code solution#2: 从前往后添加; code solution#3: 使用Insert; code 参考 1. leetcode_easy_string_1556.
阅读全文
摘要:problem 1576. Replace All ?'s to Avoid Consecutive Repeating Characters solution#1: code: 注意,如何取得满足题意的替换字符;注意字符串边界; 参考 1. leetcode_easy_string_1576. R
阅读全文
摘要:problem 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence solution#1: 使用string的特性和count函数; code solution#2: 通过空格split得到字符,然后判断; code
阅读全文
摘要:problem 1624. Largest Substring Between Two Equal Characters solution#1: code 参考 1. leetcode_easy_string_1624. Largest Substring Between Two Equal Cha
阅读全文
摘要:problem 1544. Make The String Great solution#1: code 参考 1. leetcode_easy_string_1544. Make The String Great; 完
阅读全文
摘要:problem 1496. Path Crossing solution#1: 使用set和pair; code 注意,set和pair的使用; 参考 1. leetcode_easy_string_1496. Path Crossing; 2. set的使用; 3. pair的使用; 完
阅读全文
摘要:problem 1408. String Matching in an Array solution#1: 使用set类型; code solution#2: 使用字符串; code 注意查找的关键; solution#3: 先排序后查找; code 参考 1. leetcode_easy_stri
阅读全文
摘要:problem 1544. Make The String Great solution#1:Brute-Force; code 注意1,如何判断两个字符是同一个字母的大小写呢?! 注意2,for循环的限制条件; 注意3,while循环的条件,或者外层循环结束的条件; solution#2: two
阅读全文
摘要:problem 1592. Rearrange Spaces Between Words solution#1: code 注意,如何分离单词; 参考 1. leetcode_easy_string_1592. Rearrange Spaces Between Words; 完
阅读全文
摘要:problem 1598. Crawler Log Folder solution#1: 使用stack; code solution#2: code 参考 1. leetcode_easy_stack_1598. Crawler Log Folder; 完
阅读全文
摘要:problem 1441. Build an Array With Stack Operations 题意: 这道题目重在理解题目意思; 有一个递增数组target,其中的元素是[1, n]之间的整数, 对于[1, n]之间且不大于target最大值的所有整数, 若target中不存在该数值,则先a
阅读全文
摘要:problem 1047. Remove All Adjacent Duplicates In String solution#1: 使用stack; code: solution#2: 快慢指针; code solution#3: 数据类型string的特性; code 参考 1. leetcod
阅读全文
摘要:problem 1021. Remove Outermost Parentheses solution#1: stack; code solution#2: code 参考 1. leetcode_easy_stack_1021. Remove Outermost Parentheses; 2. 【
阅读全文
摘要:problem 392. Is Subsequence solution#1: two pointers,快慢指针; code solution#2: Follow Up中描述有很长的字符串,如何优化; 使用 uppper_bound() 来二分查找第一个大于 pre 的位置; code 参考 1.
阅读全文
摘要:problem 1614. Maximum Nesting Depth of the Parentheses 理解题意;题目描述的比较繁琐,重在理解核心思想; solution#1: code 参考 1. leetcode_easy_string_1614. Maximum Nesting Dept
阅读全文
摘要:problem 1005. Maximize Sum Of Array After K Negations 题意 solution#1: code solution#2: 先循环k次,每次把最小值前加负号,然后遍历求和; code solution#3: 翻转,应尽可能的翻转负数,同时翻转两次是可以
阅读全文
摘要:problem 1528. Shuffle String solution#1: code 参考 1. leetcode_easy_sort_1528. Shuffle String; 完
阅读全文
摘要:problem 1518. Water Bottles 题意: solution#1:迭代; code solution#2: 迭代; code solution#3: 数学;oneline; code 参考 1. leetcode_easy_greedy_1518. Water Bottles;
阅读全文
摘要:problem 1403. Minimum Subsequence in Non-Increasing Order 题意 重在理解题意,找出这样的最小子序列,肯定从数组中最大数开始一个一个提取,直到子序列的和大于剩余在原数组的元素之和。关键在于怎么提取数组中的最大数。可以排序,或者使用数值的数量。也
阅读全文