自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 68. Text Justification

解题思路这是一个典型的分治算法,基本思路就是:扫描字符串数组,累加长度,当发现长度超过最大长度的时候,就把前面的几个字符串按规则组合,加入到List中。public List<String> fullJustify(String[] words, int maxWidth) { List<String> result = new ArrayList<>(); if(w

2016-10-05 10:21:03 214

原创 295. Find Median from Data Stream

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.Examples: [2,3,4] , the median

2016-01-04 19:38:28 225

原创 Best Time to Buy and Sell Stock with Cooldown

来源:http://segmentfault.com/a/1190000004193861因为当前日期买卖股票会受到之前日期买卖股票行为的影响,首先考虑到用DP解决。这道题比较麻烦的是有个cooldown的限制,其实本质也就是买与卖之间的限制。对于某一天,股票有三种状态: buy, sell, cooldown, sell与cooldown我们可以合并成一种状态,因为手

2016-01-03 21:22:04 275

原创 Best Time to Buy and Sell Stock IV

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 at most k transactions. Note: Yo

2016-01-03 16:36:54 192

原创 ERROR: Error installing rails: ERROR: Failed to build gem native extension.

问题描述:Building native extensions.  This could take a while...ERROR:  Error installing rails:ERROR: Failed to build gem native extension.    /home/gubobo/.rvm/rubies/ruby-2.1.7/bin/ruby extc

2015-12-19 02:38:23 1189

原创 关于python的编码问题和raw_input的乱码问题

raw_input出现中文乱码原因:1、python字符串默认以ascii的方式编码str2、raw_input不支持unicode编码,所以使用raw_input(u"哈哈哈")也会乱码3、cmd窗口默认支持gbk编码,

2015-11-18 08:17:46 382

原创 关于bundle install遇到到的问题

bundle install时出现下面的问题:Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/gems/rack-1.4.1.gem)问题原因:据说是因为rails的源在外国服务器上,所以连接不上去.

2015-10-22 00:24:59 929

原创 PHP的第一天学习遇到的问题

1》wamp跳转到IIS服务器的问题解决:主要是端口问题,在wamp的配置文件中修改端口。2》wamp的localhost 的默认端口修改问题请参考下面链接修改:http://www.wuwenhui.cn/3047.html

2015-07-01 16:59:34 236

空空如也

空空如也

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

TA关注的人

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