• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
THE WAY I AM
博客园    首页    新随笔    联系   管理    订阅  订阅
04 2019 档案
654. Maximum Binary Tree最大二叉树

摘要:网址:https://leetcode.com/problems/maximum-binary-tree/ 参考: https://leetcode.com/problems/maximum-binary-tree/discuss/106146/C%2B%2B-O(N)-solution 我自己的做 阅读全文
posted @ 2019-04-27 11:54 549 阅读(83) 评论(0) 推荐(0)
102. Binary Tree Level Order Traversal二叉树层序遍历

摘要:网址:https://leetcode.com/problems/binary-tree-level-order-traversal/ 参考:https://www.cnblogs.com/grandyang/p/4051321.html 二叉树的层次遍历的做法是维护一个队列,不断使节点入队,使用了 阅读全文
posted @ 2019-04-25 21:22 549 阅读(86) 评论(0) 推荐(0)
983. Minimum Cost For Tickets

摘要:网址:https://leetcode.com/problems/minimum-cost-for-tickets/ 参考:https://leetcode.com/problems/minimum-cost-for-tickets/discuss/226659/Two-DP-solutions-w 阅读全文
posted @ 2019-04-24 17:54 549 阅读(92) 评论(0) 推荐(0)
229. Majority Element II求众数II

摘要:网址:https://leetcode.com/problems/majority-element-ii/ 参考:https://blog.csdn.net/u014248127/article/details/79230221 摩尔投票算法( Boyer-Moore Voting Algorith 阅读全文
posted @ 2019-04-23 15:44 549 阅读(92) 评论(0) 推荐(0)
169. Majority Element求众数

摘要:网址:https://leetcode.com/problems/majority-element/ 参考:https://blog.csdn.net/u014248127/article/details/79230221 不断的消去两个不同的数,最后剩下的数肯定是所求的众数! 细节: 阅读全文
posted @ 2019-04-22 21:49 549 阅读(107) 评论(0) 推荐(0)
567. Permutation in String字符串的排列(效率待提高)

摘要:网址:https://leetcode.com/problems/permutation-in-string/ 参考:https://leetcode.com/problems/permutation-in-string/discuss/102588/Java-Solution-Sliding-Wi 阅读全文
posted @ 2019-04-21 00:24 549 阅读(100) 评论(0) 推荐(0)
51. N-Queens N皇后

摘要:网址:https://leetcode.com/problems/n-queens/ 类似见:https://www.cnblogs.com/tornado549/p/10701124.html 阅读全文
posted @ 2019-04-13 15:46 549 阅读(82) 评论(0) 推荐(0)
52. N-Queens II N皇后II

摘要:网址:https://leetcode.com/problems/n-queens-ii/ 方法1:按照逻辑思路,通过回溯法解决问题。速度较慢! 方法2:位运算 参考:https://www.bilibili.com/video/av46292575/?p=43 阅读全文
posted @ 2019-04-13 14:45 549 阅读(116) 评论(0) 推荐(0)
322. Coin Change零钱兑换

摘要:网址:https://leetcode.com/problems/coin-change/ 典型的动态规划问题,类比背包问题,这就是完全背包问题 阅读全文
posted @ 2019-04-10 20:06 549 阅读(134) 评论(0) 推荐(0)
43. Multiply Strings字符串相乘

摘要:网址:https://leetcode.com/problems/multiply-strings/submissions/ 参考:https://leetcode.com/problems/multiply-strings/discuss/17605/Easiest-JAVA-Solution-w 阅读全文
posted @ 2019-04-09 20:32 549 阅读(119) 评论(0) 推荐(0)
977. Squares of a Sorted Array有序数组的平方

摘要:网址:https://leetcode.com/problems/squares-of-a-sorted-array/ 双指针法 把左端的元素和右端的元素比较后挑出绝对值大的,将其平方放入ans中,并且将指针往中间移动 不断循环上述过程,直至两指针重合。注意处理重合位置 最后将 ans 通过 rev 阅读全文
posted @ 2019-04-09 18:37 549 阅读(95) 评论(0) 推荐(0)
1018. Binary Prefix Divisible By 5可被 5 整除的二进制前缀

摘要:网址:https://leetcode.com/problems/binary-prefix-divisible-by-5/ 一次for循环遍历数组,在上次计算的基础上得到本次的结果! 阅读全文
posted @ 2019-04-08 14:21 549 阅读(179) 评论(0) 推荐(0)
1021. Remove Outermost Parentheses删除最外层的括号

摘要:网址:https://leetcode.com/problems/remove-outermost-parentheses/ 使用栈的思想,选择合适的判断时机 删除最外层的括号 阅读全文
posted @ 2019-04-08 10:15 549 阅读(246) 评论(0) 推荐(0)
1022. Sum of Root To Leaf Binary Numbers从根到叶的二进制数之和

摘要:网址:https://leetcode.com/problems/sum-of-root-to-leaf-binary-numbers/ 递归调用求和,同时注意%1000000007的位置 阅读全文
posted @ 2019-04-08 10:14 549 阅读(242) 评论(0) 推荐(0)
1023. Camelcase Matching驼峰式匹配

摘要:网址:https://leetcode.com/problems/camelcase-matching/ 依题意可得逻辑 阅读全文
posted @ 2019-04-08 10:09 549 阅读(275) 评论(0) 推荐(0)
3. Longest Substring Without Repeating Characters无重复字符的最长子串

摘要:网址:https://leetcode.com/problems/longest-substring-without-repeating-characters/ 显然采用sliding window滑动窗口法,辅助以哈希表,判断字符是否已使用 不断扩充 j,直到 s[j] 已经使用 此时,把 i 移 阅读全文
posted @ 2019-04-04 21:14 549 阅读(98) 评论(0) 推荐(0)
946. Validate Stack Sequences验证栈序列

摘要:网址:https://leetcode.com/problems/validate-stack-sequences/ 参考:https://leetcode.com/problems/validate-stack-sequences/discuss/197667/Java-straight-forw 阅读全文
posted @ 2019-04-04 00:12 549 阅读(183) 评论(0) 推荐(0)
238. Product of Array Except Self除自身以外数组的乘积

摘要:网址:https://leetcode.com/problems/product-of-array-except-self/ 参考:https://leetcode.com/problems/product-of-array-except-self/discuss/65622/Simple-Java 阅读全文
posted @ 2019-04-02 14:33 549 阅读(95) 评论(0) 推荐(0)
91. Reverse Linked List 反转链表

摘要:网址:https://leetcode.com/problems/reverse-linked-list/ 直接参考92:https://www.cnblogs.com/tornado549/p/10639756.html 阅读全文
posted @ 2019-04-01 22:40 549 阅读(100) 评论(0) 推荐(0)
92. Reverse Linked List II 反转链表 II

摘要:网址:https://leetcode.com/problems/reverse-linked-list-ii/ 核心部分:通过a、b、c三个变量之间的相互更新,不断反转部分链表 然后将反转部分左右两端接上! 当测试数据 m 为 1 时,原始代码行不通。 故我们在原head前加一个fake_h节点, 阅读全文
posted @ 2019-04-01 22:37 549 阅读(91) 评论(0) 推荐(0)

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3