摘要: leetcode -Move ZeroesGiven an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero element... 阅读全文
posted @ 2015-10-06 16:33 cnblogshnj 阅读(75) 评论(0) 推荐(0) 编辑
摘要: leetcode -Ugly NumberWrite a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only incl... 阅读全文
posted @ 2015-10-05 14:13 cnblogshnj 阅读(100) 评论(0) 推荐(0) 编辑
摘要: leetcode -Sort ColorsGiven an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors... 阅读全文
posted @ 2015-10-05 12:04 cnblogshnj 阅读(99) 评论(0) 推荐(0) 编辑
摘要: leetcode -Product of Array Except SelfGiven an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all... 阅读全文
posted @ 2015-10-03 16:44 cnblogshnj 阅读(140) 评论(0) 推荐(0) 编辑
摘要: STL 容器顺序容器vector 内存连续,两倍增长deque 内存小片连续,链表相连。 双端队列。list 内存不连续。 双向链表。关联容器map 红黑树实现set 红黑树实现容器适配器queue 队列。先入先出 在deque基础上封装;stack 栈。 先进后出 在deque基础上封装;prio... 阅读全文
posted @ 2015-08-22 16:32 cnblogshnj 阅读(97) 评论(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 阅读(113) 评论(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 阅读(127) 评论(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 阅读(111) 评论(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 阅读(143) 评论(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 阅读(157) 评论(0) 推荐(0) 编辑