随笔分类 -  leetcode

摘要:Contains Duplicate IIIGiven an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennum... 阅读全文
posted @ 2015-06-23 14:43 imKirin 阅读(173) 评论(0) 推荐(0)
摘要:Contains Duplicate IIGiven an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[... 阅读全文
posted @ 2015-06-23 13:12 imKirin 阅读(194) 评论(0) 推荐(0)
摘要:Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at leas... 阅读全文
posted @ 2015-06-23 11:11 imKirin 阅读(171) 评论(0) 推荐(0)
摘要:Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre... 阅读全文
posted @ 2015-06-10 10:40 imKirin 阅读(195) 评论(0) 推荐(0)
摘要:Rectangle AreaFind the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right co... 阅读全文
posted @ 2015-06-09 16:36 imKirin 阅读(177) 评论(0) 推荐(0)
摘要:Rotate ImageYou are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?分析:rota... 阅读全文
posted @ 2015-05-11 13:30 imKirin 阅读(115) 评论(0) 推荐(0)
摘要:House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint... 阅读全文
posted @ 2015-05-08 16:27 imKirin 阅读(237) 评论(0) 推荐(0)
摘要:Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot... 阅读全文
posted @ 2015-05-08 16:01 imKirin 阅读(145) 评论(0) 推荐(0)
摘要:Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.分析: 我们知道,BS... 阅读全文
posted @ 2015-05-07 14:54 imKirin 阅读(93) 评论(0) 推荐(0)
摘要:Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi... 阅读全文
posted @ 2015-05-07 13:15 imKirin 阅读(148) 评论(0) 推荐(0)
摘要:Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, wh... 阅读全文
posted @ 2015-05-07 12:49 imKirin 阅读(151) 评论(0) 推荐(0)
摘要:Binary Tree Right Side ViewGiven a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered fr... 阅读全文
posted @ 2015-05-06 11:26 imKirin 阅读(112) 评论(0) 推荐(0)
摘要:Number of IslandsGiven a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by con... 阅读全文
posted @ 2015-05-06 10:03 imKirin 阅读(149) 评论(0) 推荐(0)
摘要:Bitwise AND of Numbers RangeGiven a range [m, n] where 0 >= 1) lena++; while(b >>= 1) lenb++; if(lena == lenb) { for(int i = m... 阅读全文
posted @ 2015-05-05 18:39 imKirin 阅读(146) 评论(0) 推荐(0)
摘要:Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi... 阅读全文
posted @ 2015-05-05 16:59 imKirin 阅读(113) 评论(0) 推荐(0)
摘要:Remove Linked List ElementsRemove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,va... 阅读全文
posted @ 2015-05-05 16:16 imKirin 阅读(94) 评论(0) 推荐(0)
摘要:Reverse Linked ListReverse a singly linked list.click to show more hints.Have you met this question in a real interview?class Solution{public: ListNo... 阅读全文
posted @ 2015-05-05 10:36 imKirin 阅读(132) 评论(0) 推荐(0)
摘要:Count PrimesDescription:Count the number of prime numbers less than a non-negative number,nclick to show more hints.References:How Many Primes Are The... 阅读全文
posted @ 2015-05-04 19:49 imKirin 阅读(124) 评论(0) 推荐(0)
摘要:Isomorphic StringsGiven two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All... 阅读全文
posted @ 2015-05-04 10:57 imKirin 阅读(157) 评论(0) 推荐(0)
摘要:Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangemen... 阅读全文
posted @ 2015-04-07 14:04 imKirin 阅读(189) 评论(0) 推荐(0)