自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

U_F_O

追美剧,爱火锅,要自由。

  • 博客(23)
  • 资源 (3)
  • 收藏
  • 关注

原创 B. The least round way

There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it thatstarts in the upper left cell of the matrix; each following cell is to the right or dow

2017-03-19 20:43:57 354

原创 [Array]Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Example 1:Input: k = 3, n =

2016-07-21 13:00:58 346

原创 [Array]Combination Sum II

Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.No

2016-07-21 12:58:26 281

原创 [Array]Combination Sum

Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of t

2016-07-21 12:56:38 248

原创 [Array]Minimum Size Subarray Sum

Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.For example, given the array [2,3,1,2,4,

2016-07-21 08:59:32 223

原创 [Array]Find Peak Element

A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, in that case

2016-07-21 08:43:36 256

原创 [Array]3Sum Closest

Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly

2016-07-18 08:32:43 199

原创 [Array] Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons

2016-07-15 10:45:14 586

原创 [Array]Pascal's Triangle II

Given an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1].Note: Could you optimize your algorithm to use only O(k) extra space?方法:在每一行的更新中,从后往前进行更新可以使代码

2016-07-15 08:41:21 287

原创 [Array] Pascal's Triangle

Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] 方法:正常模拟即可。class Solution {pu

2016-07-15 08:30:56 258

原创 [Array] 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 day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi

2016-07-14 09:07:36 227

原创 [Array]Move Zeroes

Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your funct

2016-07-13 09:19:56 243

原创 [Array]Majority Element

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 majority element always

2016-07-13 08:55:24 257

原创 [Array]Merge Sorted Array

Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional

2016-07-09 14:37:11 222

原创 [Array]Rotate Array

Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].方法1:将k%size进行处理后将最后面k个插入到前面。class Solution {public:

2016-07-08 12:47:12 225

原创 [Array]Contains Duplicate

Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is

2016-07-07 23:36:41 274

原创 [Array]Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.思路:利用unorde

2016-07-07 13:05:43 197

原创 2A. Winner

A. Winner time limit :per test 1 second memory limit: per test 64 megabytes input: standard input output: standard output The winner of the card game popular in Berland “Berlogging” is determined

2016-07-05 23:24:23 306

原创 [Array]Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example: Given nums = [2, 7, 11

2016-07-02 21:45:03 215

原创 1C. Ancient Berland Circus

time limit: per test 2 seconds memory limit :per test 64 megabytes input:standard input output:standard output Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in th

2016-06-30 23:21:43 426

原创 [Array]Remove Element

Given 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 with constant memory.The order

2016-06-29 08:25:26 248

原创 1B. Spreadsheets

1B. Spreadsheetstime limit :per test10 seconds memory limit :per test64 megabytes input:standard input output:standard output In the popular spreadsheets systems (for example, in Excel) the followi

2016-06-27 11:53:50 283

原创 1A. Theatre Square

A. Theatre Squaretime limit: per test 1 second memory limit: per test 256 megabytes input: standard input output: standard outputTheatre Square in the capital city of Berland has a rectangular sha

2016-06-26 16:05:12 387

算法入门竞赛经典刘汝佳第一章习题答案

算法入门竞赛经典刘汝佳第一章习题答案,这是第一章的答案,过后答案将会陆续给出

2015-01-26

浙江大学PAT

浙江大学PAT平台基本级别,都AC过了,欢迎各位下载。

2015-01-20

Thinking in C++第二章答案

本文档是对Thinking in C++第二章的答案,所有代码均已经用过,可靠。

2014-02-06

空空如也

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

TA关注的人

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