java自学
文章平均质量分 75
mxy940127
123
展开
-
LeetCode刷题(FizzBuzz)
问题描述:Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “原创 2017-01-23 13:42:18 · 490 阅读 · 0 评论 -
Leetcode刷题(Max Consecutive Ones)
问题描述:Given a binary array, find the maximum number of consecutive 1s in this array.即 找到二进制数组中最多的连续1的个数。Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits a原创 2017-01-23 15:23:50 · 198 阅读 · 0 评论 -
Leetcode刷题(Reverse String)
问题描述:Write a function that takes a string as input and returns the string reversedExample:Given s = "hello", return "olleh".此题很简单,使用java StringBuffer下reverse命令即可最简单的方法:public class S原创 2017-01-23 16:55:45 · 188 阅读 · 0 评论 -
Leetcode刷题(Single Number)
问题描述:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using原创 2017-01-23 21:18:10 · 172 阅读 · 0 评论 -
Leetcode刷题(Nim Game)
问题描述:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will原创 2017-01-23 21:05:18 · 178 阅读 · 0 评论 -
LeetCode刷题(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,原创 2017-01-21 13:55:27 · 211 阅读 · 0 评论 -
LeetCode刷题(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-03-10 11:28:56 · 299 阅读 · 0 评论