自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Spiral Matrix II -- leetcode

Given an integer n, generate a square matrix filled with elements from 1 ton2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [

2015-03-28 16:56:57 465

原创 Length of Last Word -- leetcode

Given a string s consists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defi

2015-03-28 15:18:37 495

原创 Merge Intervals -- leetcode

Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. /** * Definition for an interval. * struct In

2015-03-28 14:35:23 508

原创 Insert Interval -- leetcode

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Examp

2015-03-28 11:36:54 534

原创 Best Time to Buy and Sell Stock IV -- leetcode

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at most k transactions.Note:You may not

2015-03-27 14:58:05 707 2

原创 Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one

2015-03-27 14:13:29 338

原创 Best Time to Buy and Sell Stock III -- leetcode

Say you have an array for which the ith element is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may n

2015-03-27 14:09:05 332

转载 找零钱的两种方法

有时候,去便利店买几块钱的东西,但没有零钱,只能给他们一张100的,他们可能找给我一沓10块的和几枚硬币。我不喜欢这么多的零钱,要知道,钱越零散,散失地就越快,我希望找给我的零钱张数最少。如何找出最少数目(钱的张数)的零钱呢?这个问题看起来很简单,假设要用50、20、10、5、1(元)找出87元来,任何人都可以简单地得出:1张50、1张20、1张10、1张5和2张1元就可以满足。可以用代码表示

2015-03-27 09:26:34 1891

转载 Unix/Linux 脚本中 “set -e” 的作用

-----------------------------------------------------------#!/bin/bashset -ecommand 1command 2...exit 0----------------------------------------------------------Every script yo

2015-03-08 19:47:38 446

原创 Spiral Matrix -- leetcode

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]

2015-03-08 17:30:32 418

原创 Maximum Subarray -- leetcode

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 subarray [4,−1,2,1] ha

2015-03-08 10:10:48 499

空空如也

空空如也

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

TA关注的人

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