自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 《将博客搬至CSDN》

《将博客搬至CSDN》 转载于:https://www.cnblogs.com/GoFly/p/6703395.html

2017-04-13 12:57:00 72

转载 策略模式(Strategy Pattern)

策略模式(Strategy Pattern)   抛开晦涩的定义,首先看一个例子:   我们想要创建一个模拟鸭子的游戏,在这个游戏中,会有各种类型的鸭子,比如mallard duck,red head duck,rubber duck(除了rubber duck(橡皮鸭),看见这其余两种鸭子很好奇,于是查找相关图片,发现mallard duck是绿头鸭,red head ...

2016-08-13 14:59:00 133

转载 [Array]Game of Life

According to theWikipedia's article: "TheGame of Life, also known simply asLife, is a cellular automaton devised by the British mathematician John Horton Conway in 1970." Given aboardwithm...

2016-08-11 13:30:00 87

转载 [Array]Find Minimum in Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate exists in the...

2016-08-09 20:23:00 77

转载 [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...

2016-07-21 13:00:00 72

转载 [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 comb...

2016-07-21 12:58:00 68

转载 [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 n...

2016-07-21 12:56:00 69

转载 [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 [...

2016-07-21 08:59:00 80

转载 [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, ...

2016-07-21 08:43:00 68

转载 [Array]3 Sum 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 ...

2016-07-18 08:32:00 64

转载 [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...

2016-07-15 10:45:00 53

转载 [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:00 70

转载 [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] ] 方法:正常模拟即可...

2016-07-15 08:30:00 83

转载 [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 st...

2016-07-14 09:07:00 76

转载 [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 ...

2016-07-13 09:19:00 98

转载 [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 eleme...

2016-07-13 08:55:00 61

转载 [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...

2016-07-09 14:37:00 70

转载 [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 Solutio...

2016-07-08 12:47:00 65

转载 [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 ele...

2016-07-07 23:36:00 65

转载 [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. 利...

2016-07-07 13:05:00 79

转载 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” ...

2016-07-05 23:24:00 147

转载 [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...

2016-07-02 21:45:00 54

转载 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 meter...

2016-06-30 23:21:00 119

转载 [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...

2016-06-29 08:25:00 67

转载 1B. Spreadsheets

1B. Spreadsheets time limit :per test10 seconds memory limit :per test64 megabytes input:standard input output:standard output In the popular spreadsheets systems (for example, in Exce...

2016-06-27 11:53:00 108

转载 1A. Theatre Square

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

2016-06-26 16:05:00 154

空空如也

空空如也

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

TA关注的人

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