自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Java中“==”和equal的区别

==比较的是对象引用的地址,也就是是否是同一个对象; equal比较的是对象的值。 例如: Integer r1 = new Integer(900);//定义r1整型对象 Integer r2 = new Integer(900);//定义r2整型对象 System.out.println(r1==r2);//返回false System.out.println(r1.e

2015-11-29 00:25:55 1646

原创 Additive Number-LeetCode

这是问题: Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent numb

2015-11-29 00:22:33 1029

原创 Range Sum Query - Mutable -leetcode

这道题目是我之前做的RangeSum的一维形式的另一个变种。这次虽然空间上面是一维,但是其时间上进行了一个修改,导致问题的解决思路发生了改变,反倒回归了我刚一开始解题所想到的快速求某一个线段的长度的想法。引入了一中新的,或者我还不熟悉的数据结构。 SegmentTree。线段树,或者叫做区间树。 实际上还是称为区间树更好理解一些。 树:是一棵树,而且是一棵二叉树。 线段:树上的

2015-11-25 17:28:31 906

原创 Adapter Pattern——Head First Design Pattern

Concept:Converts the interface of a class into another interface the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interface.This acts to decouple t

2015-11-23 23:05:33 551

原创 Unique Paths II-leetcode

这道题是Uniue Paths的一个变种,却然我受益匪浅。 由于第一道题目我使用排列组合的算法做的,导致这道题目用同样的办法就会很麻烦。 使用第一问的结论来进行求解,将每个障碍划分为障碍之上和障碍之下的部分。但是多个障碍有一些会重复加减,就涉及到类似于概率论当中的加上每一个,减去两个交集,加上三个个的交集以此类推。虽然编码可以实现但真的是略显麻烦,而且容易出错。相信题目应该没有这么难,就看了其他

2015-11-22 16:45:38 488

原创 Unique Paths -leetcode

这样一道题目: A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to

2015-11-16 23:46:14 504

原创 Range Sum Query 2D - Immutable My Submissionsstion-leetcode

这道题目承接了上面一题。只是由二维变换成为了三维。这里却由衷地侥幸,因为我尽管绝得我数学学的不好,但是我还是收到了概率论中求概率模型的启发而做了出来。 Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) a

2015-11-16 11:35:15 544

原创 Range Sum Query - Immutable from Leetcode

这样一道题目: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 sumRange(2,

2015-11-15 21:27:31 438

原创 Singleton Pattern ——book review by Mac

Ways of singleton pattern can be trade with different situations.They need to trade off to do so.Single thread singleton Multi-thread ones double check one synchronized onePrinciplessynchronized ones

2015-11-09 00:13:45 414

空空如也

空空如也

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

TA关注的人

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