cKK

............当你觉得自己很辛苦,说明你正在走上坡路.............坚持做自己懒得做但是正确的事情,你就能得到别人想得到却得不到的东西............

导航

随笔分类 -  LeetCode

摘要:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { ... 阅读全文

posted @ 2016-06-29 11:37 cKK 阅读(161) 评论(0) 推荐(0)

摘要:/* Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each element in the result should appear as many times... 阅读全文

posted @ 2016-06-25 15:07 cKK 阅读(218) 评论(0) 推荐(0)

摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文

posted @ 2016-06-25 14:19 cKK 阅读(139) 评论(0) 推荐(0)

摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文

posted @ 2016-06-24 16:14 cKK 阅读(210) 评论(0) 推荐(0)

摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文

posted @ 2016-06-23 10:09 cKK 阅读(122) 评论(0) 推荐(0)

摘要:Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should have a linear runtime c 阅读全文

posted @ 2016-04-19 14:00 cKK 阅读(161) 评论(0) 推荐(0)

摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文

posted @ 2016-04-12 21:06 cKK 阅读(139) 评论(0) 推荐(0)

摘要:Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文

posted @ 2016-04-12 15:26 cKK 阅读(196) 评论(0) 推荐(0)

摘要: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 阅读全文

posted @ 2016-04-12 02:14 cKK 阅读(107) 评论(0) 推荐(0)

摘要: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 阅读全文

posted @ 2016-04-11 23:49 cKK 阅读(119) 评论(0) 推荐(0)

摘要: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 ston 阅读全文

posted @ 2016-04-11 21:10 cKK 阅读(120) 评论(0) 推荐(0)

摘要: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 阅读全文

posted @ 2016-04-11 20:03 cKK 阅读(117) 评论(0) 推荐(0)

摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo 阅读全文

posted @ 2016-04-11 02:43 cKK 阅读(138) 评论(0) 推荐(0)

摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文

posted @ 2016-04-11 01:19 cKK 阅读(153) 评论(0) 推荐(0)

摘要:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". 阅读全文

posted @ 2016-04-10 02:48 cKK 阅读(145) 评论(0) 推荐(0)

摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文

posted @ 2016-04-10 02:21 cKK 阅读(181) 评论(0) 推荐(0)

摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文

posted @ 2016-04-06 15:13 cKK 阅读(167) 评论(0) 推荐(0)

摘要:Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 -- 阅读全文

posted @ 2016-04-06 15:08 cKK 阅读(161) 评论(0) 推荐(0)

摘要:e.g. i love java return java love i 阅读全文

posted @ 2016-03-30 22:24 cKK 阅读(377) 评论(0) 推荐(0)

摘要:e.g. aaabbcccc 返回a3b2c4 阅读全文

posted @ 2016-03-30 22:22 cKK 阅读(282) 评论(0) 推荐(0)