随笔分类 -  leetcode

上一页 1 2 3 4 5 6 ··· 19 下一页

【leetcode_easy_string】1436. Destination City
摘要:problem 1436. Destination City solution#1: 使用map; code solution#2: 使用set; code 参考 1. leetcode_easy_string_1436. Destination City; 完 阅读全文

posted @ 2021-02-04 18:32 鹅要长大 阅读(28) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1556. Thousand Separator
摘要:problem 1556. Thousand Separator solution#1: 使用to_string和迭代; code solution#2: 从前往后添加; code solution#3: 使用Insert; code 参考 1. leetcode_easy_string_1556. 阅读全文

posted @ 2020-12-22 21:05 鹅要长大 阅读(72) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1576. Replace All ?'s to Avoid Consecutive Repeating Characters
摘要:problem 1576. Replace All ?'s to Avoid Consecutive Repeating Characters solution#1: code: 注意,如何取得满足题意的替换字符;注意字符串边界; 参考 1. leetcode_easy_string_1576. R 阅读全文

posted @ 2020-12-22 21:00 鹅要长大 阅读(78) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence
摘要: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 阅读全文

posted @ 2020-12-20 17:08 鹅要长大 阅读(104) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1624. Largest Substring Between Two Equal Characters
摘要:problem 1624. Largest Substring Between Two Equal Characters solution#1: code 参考 1. leetcode_easy_string_1624. Largest Substring Between Two Equal Cha 阅读全文

posted @ 2020-12-20 17:05 鹅要长大 阅读(77) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1544. Make The String Great
摘要:problem 1544. Make The String Great solution#1: code 参考 1. leetcode_easy_string_1544. Make The String Great; 完 阅读全文

posted @ 2020-12-20 17:04 鹅要长大 阅读(75) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1496. Path Crossing
摘要:problem 1496. Path Crossing solution#1: 使用set和pair; code 注意,set和pair的使用; 参考 1. leetcode_easy_string_1496. Path Crossing; 2. set的使用; 3. pair的使用; 完 阅读全文

posted @ 2020-12-20 17:04 鹅要长大 阅读(71) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1408. String Matching in an Array
摘要:problem 1408. String Matching in an Array solution#1: 使用set类型; code solution#2: 使用字符串; code 注意查找的关键; solution#3: 先排序后查找; code 参考 1. leetcode_easy_stri 阅读全文

posted @ 2020-12-20 17:03 鹅要长大 阅读(66) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1544. Make The String Great
摘要:problem 1544. Make The String Great solution#1:Brute-Force; code 注意1,如何判断两个字符是同一个字母的大小写呢?! 注意2,for循环的限制条件; 注意3,while循环的条件,或者外层循环结束的条件; solution#2: two 阅读全文

posted @ 2020-12-20 17:03 鹅要长大 阅读(91) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1592. Rearrange Spaces Between Words
摘要:problem 1592. Rearrange Spaces Between Words solution#1: code 注意,如何分离单词; 参考 1. leetcode_easy_string_1592. Rearrange Spaces Between Words; 完 阅读全文

posted @ 2020-12-03 13:01 鹅要长大 阅读(93) 评论(0) 推荐(0) 编辑

【leetcode_easy_stack】1598. Crawler Log Folder
摘要:problem 1598. Crawler Log Folder solution#1: 使用stack; code solution#2: code 参考 1. leetcode_easy_stack_1598. Crawler Log Folder; 完 阅读全文

posted @ 2020-12-02 07:52 鹅要长大 阅读(86) 评论(0) 推荐(0) 编辑

【leetcode_easy_stack】1441. Build an Array With Stack Operations
摘要:problem 1441. Build an Array With Stack Operations 题意: 这道题目重在理解题目意思; 有一个递增数组target,其中的元素是[1, n]之间的整数, 对于[1, n]之间且不大于target最大值的所有整数, 若target中不存在该数值,则先a 阅读全文

posted @ 2020-12-02 07:49 鹅要长大 阅读(42) 评论(0) 推荐(0) 编辑

【leetcode_easy_stack】1047. Remove All Adjacent Duplicates In String
摘要:problem 1047. Remove All Adjacent Duplicates In String solution#1: 使用stack; code: solution#2: 快慢指针; code solution#3: 数据类型string的特性; code 参考 1. leetcod 阅读全文

posted @ 2020-12-02 07:48 鹅要长大 阅读(41) 评论(0) 推荐(0) 编辑

【leetcode_easy_stack】1021. Remove Outermost Parentheses
摘要:problem 1021. Remove Outermost Parentheses solution#1: stack; code solution#2: code 参考 1. leetcode_easy_stack_1021. Remove Outermost Parentheses; 2. 【 阅读全文

posted @ 2020-12-02 07:47 鹅要长大 阅读(54) 评论(0) 推荐(0) 编辑

【leetcode_easy_BS】392. Is Subsequence
摘要:problem 392. Is Subsequence solution#1: two pointers,快慢指针; code solution#2: Follow Up中描述有很长的字符串,如何优化; 使用 uppper_bound() 来二分查找第一个大于 pre 的位置; code 参考 1. 阅读全文

posted @ 2020-12-02 07:31 鹅要长大 阅读(54) 评论(0) 推荐(0) 编辑

【leetcode_easy_string】1614. Maximum Nesting Depth of the Parentheses
摘要:problem 1614. Maximum Nesting Depth of the Parentheses 理解题意;题目描述的比较繁琐,重在理解核心思想; solution#1: code 参考 1. leetcode_easy_string_1614. Maximum Nesting Dept 阅读全文

posted @ 2020-12-02 07:17 鹅要长大 阅读(51) 评论(0) 推荐(0) 编辑

【leetcode_easy_greedy】1005. Maximize Sum Of Array After K Negations
摘要:problem 1005. Maximize Sum Of Array After K Negations 题意 solution#1: code solution#2: 先循环k次,每次把最小值前加负号,然后遍历求和; code solution#3: 翻转,应尽可能的翻转负数,同时翻转两次是可以 阅读全文

posted @ 2020-12-02 06:56 鹅要长大 阅读(52) 评论(0) 推荐(0) 编辑

【leetcode_easy_sort】1528. Shuffle String
摘要:problem 1528. Shuffle String solution#1: code 参考 1. leetcode_easy_sort_1528. Shuffle String; 完 阅读全文

posted @ 2020-12-02 06:55 鹅要长大 阅读(35) 评论(0) 推荐(0) 编辑

【leetcode_easy_greedy】1518. Water Bottles
摘要:problem 1518. Water Bottles 题意: solution#1:迭代; code solution#2: 迭代; code solution#3: 数学;oneline; code 参考 1. leetcode_easy_greedy_1518. Water Bottles; 阅读全文

posted @ 2020-12-02 06:52 鹅要长大 阅读(52) 评论(0) 推荐(0) 编辑

【leetcode_easy_greedy】1403. Minimum Subsequence in Non-Increasing Order
摘要:problem 1403. Minimum Subsequence in Non-Increasing Order 题意 重在理解题意,找出这样的最小子序列,肯定从数组中最大数开始一个一个提取,直到子序列的和大于剩余在原数组的元素之和。关键在于怎么提取数组中的最大数。可以排序,或者使用数值的数量。也 阅读全文

posted @ 2020-12-02 06:50 鹅要长大 阅读(58) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 19 下一页

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示