This is Sheffield!

Code here!


  • 首页

  • 归档

  • 标签

  • 分类

  • 关于

[LC53] Maximum Subarray / 动态规划 / 分治

发表于 2018-06-12 | 分类于 CS , LeetCode

最大子数组之和问题是 CLRS 上讲解分治算法的一道例题。由 $O(n\log(n))$ 的分治算法再到 $O(n)$ 的动态规划算法,都有很好的示范作用。

阅读全文 »

[LC42/84] Trapping Rain Water / Largest Rectangle in Histogram / 动态规划 / 双指针

发表于 2018-05-25 | 分类于 CS , LeetCode

这两题分别有不同的解法,但它们都可以用一种基于栈的方法来实现一次遍历计算结果。这种方法刚看到的时候不是很理解,思考后总结出其核心思想——确定迭代的每个步骤的「子任务」。这个选取的子任务通过循环迭代计算后,就可综合为最终结果(例如取最大/小值)。

阅读全文 »

[LC37/39/40/46-47] 用回溯算法解决问题

发表于 2018-05-08 | 分类于 CS , LeetCode

LeetCode 中一系列问题使用回溯方法解决。本篇介绍一个通用的回溯方法框架。

阅读全文 »

2018 扬州鉴真半程马拉松小记

发表于 2018-04-27 | 分类于 日常 , 随笔

扬马是我的第四次马拉松,也是第四次半马。总的来说,这是一次由于体能不足所以称不上完美,但整体流程很舒服的比赛。

阅读全文 »

[LC33-35] Search in Array / 二分查找法

发表于 2018-03-06 | 分类于 CS , LeetCode

本篇探讨二分查找法在数组检索中的应用。

阅读全文 »

[LC32] Longest Valid Parentheses / 动态规划

发表于 2017-10-29 | 分类于 CS , LeetCode

Longest Valid Parentheses - LeetCode

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", which has length = 2.
Another example is ")()())", where the longest valid parentheses substring is "()()", which has length = 4.

阅读全文 »

重新安装 macOS 的配置

发表于 2017-10-11 | 分类于 日常 , 备忘

本篇文章介绍了每次抹掉系统并重新安装 macOS 必要的恢复操作。这些工作容易遗忘,所以记下来。

阅读全文 »

[LC31] Next Permutation / 排列

发表于 2017-09-10 | 分类于 CS , LeetCode

与排列数有关的问题(计算所有排列的递归方法和非递归方法)。

阅读全文 »

[LC24/25] Swap Nodes in k-Group / 递归

发表于 2017-09-09 | 分类于 CS , LeetCode

24和25两题都是练习链表的相关操作,涉及到对链表节点的翻转。是显而易见的对经典方法——递归的使用。

阅读全文 »

[LC22] Generate Parentheses / 回溯

发表于 2017-09-08 | 分类于 CS , LeetCode

Generate Parentheses - LeetCode

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

阅读全文 »
123

Sheffield

Sheffield Ge 的技术博客

27 日志
5 分类
16 标签
© 2019 Sheffield
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4