摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2018-09-25 15:31 天地鸥 阅读(430) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2018-09-24 15:15 天地鸥 阅读(654) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Example 2: 阅读全文
posted @ 2018-09-23 19:41 天地鸥 阅读(446) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2018-09-23 15:20 天地鸥 阅读(2747) 评论(0) 推荐(0) 编辑
摘要: 3.1 概述 程序计数器,虚拟机栈,本地方法3个区域随线程而生,随线程而灭;栈中的Stack Frame随着方法进入和退出有条不紊地进行着出栈入栈操作。每个Stack Frame中分配多少内存基本上是在类结构确定下来时已知的,因此这几个区域的内存分配和回收都具备确定性,在这几个区域内就不需要过多考虑 阅读全文
posted @ 2018-09-21 09:14 天地鸥 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 二叉树的定义不多赘述,先贴上二叉树的代码 前序遍历 递归实现: 非递归实现: 中序遍历 递归实现: 非递归实现: 后序遍历 递归实现: 非递归实现: 注:不论是递归还是非递归方法,遍历整棵树的时间复杂度都是O(N),额外的空间复杂度都是O(L),N为二叉树的节点数,L为二叉树的层数。 阅读全文
posted @ 2018-09-20 21:09 天地鸥 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 快速排序的核心实现是,取一个基准数,使得数的左边小于它,数的右边大于它。 然后再对两边进行相同的递归操作。 阅读全文
posted @ 2018-09-20 13:35 天地鸥 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: 使用boolean创建一 阅读全文
posted @ 2018-09-20 10:39 天地鸥 阅读(1198) 评论(1) 推荐(0) 编辑
摘要: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Foll 阅读全文
posted @ 2018-09-20 09:32 天地鸥 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 2.1 串行、并发与并行 串行:ABC 并发:A B C 并行:A B C 2.2 竞态 2.2.1 竞态是指计算的正确性依赖于时间顺序或者线程的交错。 竞态往往伴随着Dirty Read问题,即线程读取到一个过时的数据,Lost Update问题,即一个线程对数据所做的更新没有体现在后续对其他数据 阅读全文
posted @ 2018-09-19 18:59 天地鸥 阅读(181) 评论(0) 推荐(0) 编辑