自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 213. House Robber II

Difficulty: MediumNote: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too m

2016-11-26 16:53:38 241

原创 309. Best Time to Buy and Sell Stock with Cooldown

Difficulty: MediumSay 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

2016-11-26 16:13:15 208

原创 70. Climbing Stairs

Difficulty: EasyYou 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 climb to the top?class Solu

2016-11-22 21:39:35 243

原创 121. Best Time to Buy and Sell Stock

Difficulty: EasySay you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one

2016-11-22 21:34:32 226

原创 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2016-11-16 11:04:18 98

原创 368. Largest Divisible Subset

Difficulty: MediumGiven a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0.If there

2016-11-14 22:35:57 400

原创 377. Combination Sum IV

Difficulty: MediumGiven an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1,

2016-11-09 17:13:32 221

原创 120. Triangle

Difficulty: MediumGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[

2016-11-08 23:04:56 185

原创 413. Arithmetic Slices

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 are arithmetic sequence:

2016-11-08 22:08:06 201

原创 416. Partition Equal Subset Sum

Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array e

2016-11-08 21:22:52 247

原创 121. Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2016-10-26 17:21:24 189

原创 198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2016-10-26 17:19:30 208

原创 wk5 350. Intersection of Two Arrays II

Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as ma

2016-10-12 12:20:27 228

原创 wk4 215. Kth Largest Element in an Array

Difficulty: MediumFind 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,

2016-09-28 18:00:42 220

原创 wk3 268. Missing Number

Difficulty:mediumGiven an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1, 3] return 2.

2016-09-21 12:01:34 296 1

原创 wk3 344. Reverse String

Difficulty: EasyWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".class Solution {public: string reverseString(st

2016-09-21 01:28:09 381

原创 wk3 345. Reverse Vowels of a String

Difficulty: EasyWrite a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", retu

2016-09-20 23:18:35 248

原创 wk2 238. Product of Array Except Self

Difficulty: MediumGiven an array of n integers where n > 1, nums, return an arrayoutput such that output[i] is equal to the product of all the elements ofnums except nums[i].Solve it wit

2016-09-14 01:17:08 214

原创 wk2 50. Pow(x, n)

Difficulty: MediumImplement pow(x, n).class Solution {public: double myPow(double x, int n) { double ans=1; long long n1=n; if(n1==0 || x==1) return 1; els

2016-09-14 00:18:20 298

原创 wk1 27. Remove Element

27. Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place wit

2016-09-07 02:30:09 493

原创 wk1 9. Palindrome Number

9. Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Solution:bool isPalindrome(int x) { long long reverse=0; int tmp=0, x1; if(x<0) x1=x*(-1); e

2016-09-07 01:36:30 261

原创 wk1 7. Reverse Integer

7. Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 Solution:class Solution {public:    int reverse(int x) {        int tmp=

2016-09-07 01:18:59 234

空空如也

空空如也

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

TA关注的人

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