
high frequency
文章平均质量分 51
yoohoosome
这个作者很懒,什么都没留下…
展开
-
[刷题]2 Sum
[LintCode]2 Sumpublic class Solution { /* * @param numbers : An array of Integer * @param target : target = numbers[index1] + numbers[index2] * @return : [index1 + 1, index2 + 1]原创 2015-09-25 09:53:21 · 246 阅读 · 0 评论 -
[刷题]Majority Number II
[LintCode]Majority Number IIpublic class Solution { /** * @param nums: A list of integers * @return: The majority number that occurs more than 1/3 */ public int majorityNumber原创 2015-09-07 14:42:15 · 295 阅读 · 0 评论 -
[刷题]Sort Colors
[刷题]Sort ColorsVersion 1 思路简单 O(n)class Solution { /** * @param nums: A list of integer which is 0, 1 or 2 * @return: nothing */ public void sortColors(int[] nums) {原创 2015-09-15 14:41:10 · 263 阅读 · 0 评论 -
[刷题]Best Time to Buy and Sell Stock III
[LintCode]Best Time to Buy and Sell Stock IIIclass Solution { /** * @param prices: Given an integer array * @return: Maximum profit */ public int maxProfit(int[] prices) {原创 2015-09-15 09:38:11 · 271 阅读 · 0 评论 -
[刷题]Single Number II
[刷题]Single Number IIVersion 1public class Solution { /** * @param A : An integer array * @return : An integer */ public int singleNumberII(int[] A) { // 2015-09-17 O(n)原创 2015-09-17 09:22:21 · 400 阅读 · 0 评论 -
[刷题]Sort Colors II
[LintCode]Sort Colors IIclass Solution { /** * @param colors: A list of integer * @param k: An integer * @return: nothing */ public void sortColors2(int[] colors, int k)原创 2015-09-15 15:08:51 · 418 阅读 · 0 评论 -
[刷题]Sort Letters by Case
[LintCode]Sort Letters by Casepublic class Solution { /** *@param chars: The letter array you should sort by Case *@return: void */ public void sortLetters(char[] chars) {原创 2015-09-21 09:55:37 · 295 阅读 · 0 评论 -
[刷题]Fast Power
[LintCode]Fast PowerVersion 1 O(n) 超时class Solution { /* * @param a, b, n: 32bit integers * @return: An integer */ public int fastPower(int a, int b, int n) { // 201原创 2015-09-16 14:13:15 · 422 阅读 · 0 评论 -
[刷题]O(1) Check Power of 2
[LintCode]O(1) Check Power of 2class Solution { /* * @param n: An integer * @return: True or false */ public boolean checkPowerOf2(int n) { // 2015-09-06 if (n原创 2015-09-06 09:40:04 · 293 阅读 · 0 评论 -
[刷题]Maximum Subarray III
[LintCode]Maximum Subarray IIIpublic class Solution { /** * @param nums: A list of integers * @param k: An integer denote to find k non-overlapping subarrays * @return: An integer原创 2015-09-24 10:08:51 · 438 阅读 · 0 评论 -
[刷题]3 Sum
[LintCode]3 Sumpublic class Solution { /** * @param numbers : Give an array numbers of n integer * @return : Find all unique triplets in the array which gives the sum of zero. */原创 2015-10-14 09:46:30 · 305 阅读 · 0 评论 -
[刷题]Trailing Zeros
[LintCode]Trailing Zerosclass Solution { /* * param n: As desciption * return: An integer, denote the number of trailing zeros in n! */ public long trailingZeros(long n) {原创 2015-09-09 14:43:15 · 345 阅读 · 0 评论 -
[刷题]Single Number III
[LintCode]Single Number IIIpublic class Solution { /** * @param A : An integer array * @return : An integer */ public int singleNumberII(int[] A) { // 2015-09-17 O(n) if原创 2015-09-17 09:43:57 · 249 阅读 · 0 评论 -
[刷题]Majority Number III
[LintCode]Majority Number IIIpublic class Solution { /** * @param nums: A list of integers * @param k: As described * @return: The majority number */ public int majorityN原创 2015-09-22 09:32:28 · 303 阅读 · 0 评论 -
[刷题]Subarray Sum Closest
[LintCode]Subarray Sum ClosestVersion 1 O(n^2) 超时public class Solution { /** * @param nums: A list of integers * @return: A list of integers includes the index of the first number原创 2015-09-16 14:56:24 · 943 阅读 · 0 评论 -
[刷题]Maximum Subarray
[LintCode]Maximum Subarraypublic class Solution { /** * @param nums: A list of integers * @return: A integer indicate the sum of max subarray */ public int maxSubArray(ArrayLi原创 2015-09-09 09:54:00 · 271 阅读 · 0 评论 -
[刷题]Majority Number
[LintCode]Majority Numberpublic class Solution { /** * @param nums: a list of integers * @return: find a majority number */ public int majorityNumber(ArrayList nums) {原创 2015-09-07 14:13:45 · 314 阅读 · 0 评论 -
[刷题]Single Number
[LintCode]Single Numberpublic class Solution { /** *@param A : an integer array *return : a integer */ public int singleNumber(int[] A) { // 2015-09-06 异或 if (A.length == 0) {原创 2015-09-06 14:37:29 · 257 阅读 · 0 评论 -
[刷题]Subarray Sum
[LintCode]Subarray SumVersion 1public class Solution { /** * @param nums: A list of integers * @return: A list of integers includes the index of the first number * and原创 2015-09-06 14:33:22 · 331 阅读 · 0 评论 -
[刷题]Sqrt(x)
[LintCode]Sqrt(x)class Solution { /** * @param x: An integer * @return: The sqrt of x */ public int sqrt(int x) { // 2015-09-06 用int会溢出 long start = 0;原创 2015-09-06 10:07:04 · 319 阅读 · 0 评论 -
[刷题]Best Time to Buy and Sell Stock II
[LintCode]Best Time to Buy and Sell Stock IIclass Solution { /** * @param prices: Given an integer array * @return: Maximum profit */ public int maxProfit(int[] prices) {原创 2015-09-15 09:08:13 · 309 阅读 · 0 评论 -
[刷题]Minimum Subarray
[LintCode]Minimum Subarraypublic class Solution { /** * @param nums: a list of integers * @return: A integer indicate the sum of minimum subarray */ public int minSubArray(Arr原创 2015-09-09 09:45:55 · 338 阅读 · 0 评论 -
[刷题]Partition Array
[LintCode]Partition Arraypublic class Solution { /** *@param nums: The integer array you should partition *@param k: As description *return: The index after partition */ pu原创 2015-09-23 10:14:17 · 256 阅读 · 0 评论 -
[刷题]Best Time to Buy and Sell Stock
[刷题]Best Time to Buy and Sell Stock Show result public class Solution { /** * @param prices: Given an integer array * @return: Maximum profit */ public int maxProfit(int[] pri原创 2015-09-15 08:59:11 · 274 阅读 · 0 评论