- 博客(24)
- 收藏
- 关注
原创 Calculate H Index
Question:H index 指的是在一个数组里,有s个数大于s(s 为数组中的一个元素),则H INDEX 为 s。public int HIndex(int[] a){ int[] s = new int[a.length+1]; for(int i = 0; i<a.length; i++){ s[Math.min(a
2014-03-01 00:40:05 552
原创 Swap Nodes in Pairs
Question:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only cons
2014-02-18 07:07:19 362
原创 Roman to Integer
Question:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Solution:public class Solution { public int romanToInt(String s) {
2014-02-18 07:03:22 435
原创 Remove Element
Question:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new len
2014-02-18 05:38:18 453
原创 Frenquency == 4
1. Add two numbers 32.Integer to Roman 33. Roman to Integer 24.Generate Parentheses 35. Merge k sorted list 36. Swap node in pairs 27.Remove Element 18. Permutations
2014-02-18 05:19:17 493
原创 写在2/11
今天把leetcode分类中frequency为5的题目刷了一遍,总算是有点progress, 再接再励直到找到工作为止恭喜下媳妇今天Road Test水过~接下来的任务:周三~周六:整理开始刷leetcode频率为4的题准备周四Hadoop的Meeting, 测试file level add annotation, read code about how to pre-fet
2014-02-12 07:30:07 341
原创 Word Ladder
Question:Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach interm
2014-02-12 07:24:12 566
原创 Valid Palindrome
Question:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a c
2014-02-12 07:19:20 312
原创 Valid Binary Search Tree
Question:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the
2014-02-12 07:17:19 390
原创 Merge Sorted Array
Question:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initia
2014-02-12 06:54:21 299
原创 Set Matrix Zeroes
Question:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solut
2014-02-12 06:42:48 492
原创 Climbing stairs
Question:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?//**********
2014-02-12 06:07:05 361
原创 Valid Number
Question:Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be
2014-02-11 09:12:15 323
原创 Insert Interval
Question:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their star
2014-02-11 08:07:18 391
原创 Merge Intervals
Question:Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].//********** Hints ************
2014-02-11 07:24:00 308
原创 Pow(x,n)
Question:Implement pow(x, n).//********** Hints ************如果用正常recursion会超时,此题可以用对分来处理//*****************************Solution:public class Solution { public do
2014-02-11 05:32:22 408
原创 Implement strStr()
Question:Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.//********** Hints ************KMP算法详解: h
2014-02-11 05:29:07 374
原创 Merge Two Sorted List
Question:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.//********** Hints ************M
2014-02-11 05:13:20 403
原创 Valid Parentheses
Question:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{
2014-02-11 05:01:50 350
原创 3Sum
Question:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.//********** Hin
2014-02-11 04:57:54 303
原创 String to Integer
Question:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the poss
2014-02-11 04:52:33 355
原创 Two Sum
Question:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to th
2014-02-11 04:50:20 416
原创 Frequency == 5
1. Two sum2. atoi3. 3Sum4.Remove Nth node from end of list5. merge 2 sorted list6. implement strStr()7. Pow(x,n)8. Merge Intervals9. Insert Interval10. valid number11. climbing sta
2014-02-09 22:32:02 539
原创 2014/2/3
1: CS548 Project 12: Modify my resume3: CC150 review + Chapter 174: Submit resume in BBS.
2014-02-04 04:29:57 433
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人