08 2015 档案

摘要:STL 容器顺序容器vector 内存连续,两倍增长deque 内存小片连续,链表相连。 双端队列。list 内存不连续。 双向链表。关联容器map 红黑树实现set 红黑树实现容器适配器queue 队列。先入先出 在deque基础上封装;stack 栈。 先进后出 在deque基础上封装;prio... 阅读全文
posted @ 2015-08-22 16:32 cnblogshnj 阅读(104) 评论(0) 推荐(0)
摘要:leetcode -Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST./... 阅读全文
posted @ 2015-08-21 23:38 cnblogshnj 阅读(121) 评论(0) 推荐(0)
摘要:leetcode -Valid AnagramGiven two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s... 阅读全文
posted @ 2015-08-21 22:47 cnblogshnj 阅读(134) 评论(0) 推荐(0)
摘要:leetcode -Invert Binary Treenvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Defini... 阅读全文
posted @ 2015-08-20 23:40 cnblogshnj 阅读(116) 评论(0) 推荐(0)
摘要:leetcode - Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in... 阅读全文
posted @ 2015-08-20 23:23 cnblogshnj 阅读(148) 评论(0) 推荐(0)
摘要:leetcode -Minimum Path SumGiven amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numb... 阅读全文
posted @ 2015-08-20 16:05 cnblogshnj 阅读(162) 评论(0) 推荐(0)
摘要:leetcode -Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down ... 阅读全文
posted @ 2015-08-20 14:58 cnblogshnj 阅读(147) 评论(0) 推荐(0)
摘要:leetcode -Climbing StairsYou are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many di... 阅读全文
posted @ 2015-08-20 13:17 cnblogshnj 阅读(117) 评论(0) 推荐(0)
摘要:leetcode - Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given ... 阅读全文
posted @ 2015-08-20 11:46 cnblogshnj 阅读(122) 评论(0) 推荐(0)
摘要:leetcode -Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, ther... 阅读全文
posted @ 2015-08-20 11:23 cnblogshnj 阅读(122) 评论(0) 推荐(0)
摘要:leetcode -Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm t... 阅读全文
posted @ 2015-08-19 17:14 cnblogshnj 阅读(156) 评论(0) 推荐(0)
摘要:leetcode -Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitte... 阅读全文
posted @ 2015-08-19 10:22 cnblogshnj 阅读(119) 评论(0) 推荐(0)
摘要:leetcode -Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to... 阅读全文
posted @ 2015-08-18 23:34 cnblogshnj 阅读(107) 评论(0) 推荐(0)
摘要:leetcode -Same TreeGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are struct... 阅读全文
posted @ 2015-08-18 23:16 cnblogshnj 阅读(117) 评论(0) 推荐(0)
摘要:leetcode -Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path fro... 阅读全文
posted @ 2015-08-18 23:10 cnblogshnj 阅读(122) 评论(0) 推荐(0)
摘要:leetcode -Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from... 阅读全文
posted @ 2015-08-18 17:49 cnblogshnj 阅读(81) 评论(0) 推荐(0)
摘要:leetcode -Single Number IIGiven an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should ... 阅读全文
posted @ 2015-08-18 16:22 cnblogshnj 阅读(106) 评论(0) 推荐(0)
摘要:leetcode -Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a li... 阅读全文
posted @ 2015-08-18 14:50 cnblogshnj 阅读(106) 评论(0) 推荐(0)
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
posted @ 2015-08-18 14:33 cnblogshnj 阅读(127) 评论(0) 推荐(0)
摘要:leetcode - Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The bracket... 阅读全文
posted @ 2015-08-17 18:03 cnblogshnj 阅读(122) 评论(0) 推荐(0)
摘要:leetcode -Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000,... 阅读全文
posted @ 2015-08-16 23:44 cnblogshnj 阅读(157) 评论(0) 推荐(0)
摘要:leetcode - String to Integer (atoi)Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a chal... 阅读全文
posted @ 2015-08-16 20:42 cnblogshnj 阅读(148) 评论(0) 推荐(0)
摘要:leetcode -Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky ... 阅读全文
posted @ 2015-08-16 11:51 cnblogshnj 阅读(146) 评论(0) 推荐(0)