自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 717. 1-bit and 2-bit Characters 1、2位字符

We have two special characters. The first character can be represented by one bit0. The second character can be represented by two bits (10 or11). Now given a string represented by several bit

2017-12-12 21:32:21 287

原创 643. Maximum Average Subarray I 最大平均子数组

Given an array consisting of n integers, find the contiguous subarray of given lengthk that has the maximum average value. And you need to output the maximum average value.Example 1:Input: [

2017-12-12 17:05:26 224

原创 628. Maximum Product of Three Numbers数组中三个数乘积最大

Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6Example 2:Input: [1,2,3,4]Output: 24

2017-12-12 16:06:34 497

原创 605. Can Place Flowers种植花园即边界处理

Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.Gi

2017-12-12 15:48:48 313

原创 581. Shortest Unsorted Continuous Subarray 最短未排序的子数组

Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to f

2017-12-07 17:07:12 185

原创 566. Reshape the Matrix 重排矩阵

In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a matrix represented by a two-dim

2017-12-06 17:10:08 739

原创 561. Array Partition I

Given an array of 2n integers, your task is to group these integers inton pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large

2017-12-06 16:46:41 125

原创 532. K-diff Pairs in an Array 数组中差值为k的数对数量

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here ak-diff pair is defined as an integer pair (i, j), wherei and j are both number

2017-12-06 16:34:25 549

原创 485. Max Consecutive Ones 找二进制数中连续1

Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutiv

2017-12-06 11:14:06 169

原创 189. 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].Note:Try to come up as many solutions as

2017-12-06 10:51:14 144

原创 169. Majority Element 查找多数元素

Given an array of size n, find the majority element. The majority element is the element that appearsmore than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element a

2017-12-05 22:15:30 135

原创 283. Move Zeroes移动零

Given an array nums, write a function to move all0'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

2017-12-05 22:02:37 151

原创 268. Missing Number

Given an array containing n distinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.Example 1Input: [3,0,1]Output: 2Example 2Input: [9,6,4,2,3,5,7,0

2017-12-05 21:41:25 128

原创 219. Contains Duplicate II 包含重复元素2

Given an array of integers and an integer k, find out whether there are two distinct indicesi and j in the array such thatnums[i] = nums[j] and the absolute difference betweeni and j is at most

2017-12-05 20:22:59 374

原创 217. 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

2017-12-05 19:42:05 136

原创 88. 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 tom + n) to hold ad

2017-11-29 13:22:44 132

原创 66. Plus One 加一运算

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The di

2017-11-28 20:56:06 800 1

原创 53. Maximum Subarray 最大子串和问题

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

2017-11-28 20:10:36 199

原创 35. Search Insert Position 查找插入位置

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.

2017-11-28 18:17:37 229

原创 122. 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 o

2017-11-28 16:38:16 203

原创 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)

2017-11-28 16:07:38 168

原创 27. 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 by modifying the input array

2017-11-27 17:29:56 213

原创 26. Remove Duplicates from Sorted Array 已排序数组去重

Given a sorted array, remove the duplicates in-place such that each element appear onlyonce and return the new length.Do not allocate extra space for another array, you must do this by modif

2017-11-27 17:12:31 121

原创 python根据list重命名文件夹里的所有文件

# coding = utf-8import ospath = "D:\\chunyu"#想要重命名所有文件存放的文件夹filelist = os.listdir(path) #该文件夹下所有的文件(包括文件夹)list = []fileopen = open('D:\chunyu.txt','r')#之后想要重命名成的所有名字的集合,这个名字为除去文件扩展名的文件名i =0for

2017-11-06 14:48:50 1857 1

翻译 414. Third Maximum Number

Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2,

2017-11-06 14:42:47 175

原创 python将文件夹里所有的txt文件内容写入excel

# coding=utf-8import osimport xlwt# import xlrdfile_path = 'D:\\data\\test.xls'#要写入的文件f = xlwt.Workbook(encoding='utf-8', style_compression=0)sheet = f.add_sheet('sheet1')pathDir = os.listdir("

2017-11-02 14:40:26 5811

翻译 java入门第二季

看了慕课网站上的java学习第二季,总结如下类是抽象的概念,仅仅是模板,对象是一个看得见摸得着的实体定义一个类:定义类名编写类的属性编写类的方法定义类的时候首字母要大写  成员变量的作用域是整个类内部可见,可以不赋初始值;局部变量针对于定义它的方法,必须赋初始值,不可以有多个同样名字的局部变量;两类变量重名的时候,局部变量优先级更高。 如果需要在静态方法

2017-10-30 17:59:36 227

原创 167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two number

2017-10-30 17:54:58 197

原创 448. Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Coul

2017-10-30 17:19:12 136

原创 1.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, and you may not use the same

2017-10-09 15:44:43 176

翻译 java入门第一季

本文章内容全是观看慕课java学习总结,慕课网址:http://www.imooc.com/learn/85标识符就是一些package和class的名称,在命名的时候可以由字母、数字、下划线(_)、美元符号组成,但是不能包含@和%以及空格等特殊字符,不能以数字开头 命名变量的时候只能以字母、下划线或美元符号开头,之后以数字、字母、下划线和美元符号都可以,也就是说不可以数字打头

2017-10-08 12:51:23 207

原创 安装jdk

1、去官网下载相应版本的jdk,我的电脑是win10版本,64位,所以官网下载64位的。http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html2、尽量选择安装在C盘3、修改系统路径Win+R ->control.exe->系统和安全->系统->高级系统设置->环境变量

2017-10-03 14:58:58 207

原创 hadoop2.6.0分布式集群搭建(详细),搭建es-hadoop

hadoop分布式集群的搭建,es-hadoop的搭建

2017-09-25 11:24:13 6433 1

空空如也

空空如也

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

TA关注的人

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