自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 Effective Java 读书笔记——第二章 创建和销毁对象

第6条:避免使用终结函数 终结函数(finalizer) 并不能保证会被及时的执行,时间关键的任务不应该由终结函数来完成。 Java中,当一个对象变的不可达的时候,垃圾回收器会回收与该对象相关联的储存空间,对于其他的非内存资源,一般用try-finally块来完成类似的工作。 如果一个类封装的资源确实需要回收,我们只需要提供一个显式的种植方法,并要求该类的客户在每个实例不再有用的时候终止...

2018-07-19 15:30:54 135

原创 Android开发艺术探索笔记——消息机制

消息机制概述Android的消息机制主要指Handler的运行机制以及Handler所附带的MessageQueue和Looper的工作过程。系统不允许子线程访问UI的原因是Android的UI控件不是线程安全的,多线程中并发访问可能导致UI控件处于不可预期的状态。Handler创建时会采用当前线程的Looper来构建内部的消息循环系统。Android的消息机制分析ThreadLocal的工作原理...

2018-04-10 21:41:13 231

原创 【NPC问题】证明EXACT 4SAT问题是NPC问题

【问题描述】 8.8 在EXACT 4SAT问题中,输入为一组字句,每个子句都是恰好4个文字的析取,且每个变量最多在子句中出现一次。目标是求他的满足赋值,如果该赋值存在,证明精确的4SAT问题是NP完全问题。 【证明】 如果想要证明 EXACT 4SAT问题是NPC问题,只需把目前已知的NPC问题归约到EXACT 4SAT问题。3SAT问题是和4SAT问题形式最接近的已知NPC问题。因此,我

2018-01-31 14:29:22 475

原创 LeetCode#122 Best Time to Buy and Sell Stock II

[Description]: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as

2018-01-03 16:59:27 134

原创 LeetCode#647 Palindromic Substrings

[Description]: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are counted as different substri

2018-01-03 16:26:39 130

原创 LeetCode#515 Find Largest Value in Each Tree Row

[Description]: You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]

2018-01-03 16:04:07 152

原创 LeetCode#207 Course Schedule

[Description]: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, wh

2018-01-03 15:56:34 129

原创 LeetCode#394 Decode String

[Description]: Given an encoded string, return it's decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k

2018-01-03 15:16:27 122

原创 LeetCode#104 Maximum Depth of Binary Tree

[Description]: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. [题解]: 很经典的题,找到二

2018-01-03 15:13:01 159

原创 LeetCode#53 Maximum Subarray

[Description]: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous su

2018-01-03 14:49:03 148

原创 LeetCode#332 Reconstruct Itinerary

[Description]: Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who depa

2018-01-03 14:16:51 138

原创 LeetCode#413 Arithmetic Slices

[Description]: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these ar

2018-01-03 14:00:09 152

原创 LeetCode#338 Counting Bits

[Description]: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. E

2018-01-03 13:29:12 139

原创 LeetCode#406 Queue Reconstruction by Height

[Description] Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of p

2017-11-01 15:48:14 202

原创 LeetCode#513 Find Bottom Left Tree Value

[Description] Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2:  Input: 1 / \

2017-09-23 16:46:12 149

原创 LeetCode#240 Search a 2D Matrix II

[Description] Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to

2017-09-21 14:41:11 158

原创 LeetCode#215 Kth Largest Element in an Array

[Description] Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For example, Given [3,2,1,5,6,4] an

2017-09-19 14:34:15 275

原创 LeetCode#169 Majority Element

[Description] Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majorit

2017-09-12 14:48:52 201

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除