java
文章平均质量分 63
言希墨
这个作者很懒,什么都没留下…
展开
-
java入门第一季
本文章内容全是观看慕课java学习总结,慕课网址:http://www.imooc.com/learn/85标识符就是一些package和class的名称,在命名的时候可以由字母、数字、下划线(_)、美元符号组成,但是不能包含@和%以及空格等特殊字符,不能以数字开头 命名变量的时候只能以字母、下划线或美元符号开头,之后以数字、字母、下划线和美元符号都可以,也就是说不可以数字打头翻译 2017-10-08 12:51:23 · 207 阅读 · 0 评论 -
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 · 499 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 138 阅读 · 0 评论 -
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 · 375 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 152 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 170 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 741 阅读 · 0 评论 -
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 · 314 阅读 · 0 评论 -
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 阅读 · 0 评论 -
安装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 · 208 阅读 · 0 评论 -
java入门第二季
看了慕课网站上的java学习第二季,总结如下类是抽象的概念,仅仅是模板,对象是一个看得见摸得着的实体定义一个类:定义类名编写类的属性编写类的方法定义类的时候首字母要大写 成员变量的作用域是整个类内部可见,可以不赋初始值;局部变量针对于定义它的方法,必须赋初始值,不可以有多个同样名字的局部变量;两类变量重名的时候,局部变量优先级更高。 如果需要在静态方法翻译 2017-10-30 17:59:36 · 227 阅读 · 0 评论 -
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 · 215 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 199 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 177 阅读 · 0 评论 -
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 阅读 · 0 评论 -
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 · 204 阅读 · 0 评论 -
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 · 230 阅读 · 0 评论 -
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 · 200 阅读 · 0 评论 -
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 评论 -
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 · 187 阅读 · 0 评论