上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 43 下一页

2016年12月11日

152. Maximum Product Subarray (Array; DP)

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],th 阅读全文

posted @ 2016-12-11 23:15 joannae 阅读(186) 评论(0) 推荐(0) 编辑

2016年12月9日

151. Reverse Words in a String (String)

摘要: 思路: 本题考查的目的并不是使用字符串的函数。方法是两次reverse,先对每个单词先做一次翻转,然后对整个字符串做一次翻转。 需要注意的是去除extra space,并且对全space字符串、以及最后一个单词要做特殊处理。 阅读全文

posted @ 2016-12-09 23:31 joannae 阅读(187) 评论(0) 推荐(0) 编辑

2016年11月15日

103. Binary Tree Zigzag Level Order Traversal (Tree, Queue; BFS)

摘要: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and 阅读全文

posted @ 2016-11-15 21:54 joannae 阅读(198) 评论(0) 推荐(0) 编辑

102. Binary Tree Level Order Traversal (Tree, Queue; BFS)

摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3, 阅读全文

posted @ 2016-11-15 21:46 joannae 阅读(205) 评论(0) 推荐(0) 编辑

2016年11月14日

100. Same Tree (Tree;DFS)

摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an 阅读全文

posted @ 2016-11-14 22:37 joannae 阅读(246) 评论(0) 推荐(0) 编辑

98. Validate Binary Search Tree (Tree; DFS)

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

posted @ 2016-11-14 20:39 joannae 阅读(264) 评论(0) 推荐(0) 编辑

2016年11月13日

94. Binary Tree Inorder Traversal(Tree, stack)

摘要: Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recur 阅读全文

posted @ 2016-11-13 07:09 joannae 阅读(235) 评论(0) 推荐(0) 编辑

2016年11月11日

81. Search in Rotated Sorted Array II (Array; Divide-and-Conquer)

摘要: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function 阅读全文

posted @ 2016-11-11 21:11 joannae 阅读(247) 评论(0) 推荐(0) 编辑

2016年11月2日

68. Text Justification

摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You shoul 阅读全文

posted @ 2016-11-02 20:38 joannae 阅读(149) 评论(0) 推荐(0) 编辑

2016年10月26日

58. Length of Last Word (String)

摘要: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word 阅读全文

posted @ 2016-10-26 03:49 joannae 阅读(149) 评论(0) 推荐(0) 编辑

上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 43 下一页

导航