2016年5月10日

Flatten Binary Tree to Linked List

摘要: Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: middle题目,为遍历二叉树的变种。 可以看到实际最后的linkedl 阅读全文

posted @ 2016-05-10 21:01 Sheryl Wang 阅读(169) 评论(0) 推荐(0) 编辑

2016年5月9日

Majority Element出现次数超过一半的数字

摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文

posted @ 2016-05-09 15:59 Sheryl Wang 阅读(213) 评论(0) 推荐(0) 编辑

2016年5月8日

Rotate Image

摘要: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 题目要求顺时针翻转一个二 阅读全文

posted @ 2016-05-08 16:52 Sheryl Wang 阅读(311) 评论(0) 推荐(0) 编辑

Min Stack

摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文

posted @ 2016-05-08 11:23 Sheryl Wang 阅读(147) 评论(0) 推荐(0) 编辑

2016年5月7日

Remove Duplicates from Sorted List

摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文

posted @ 2016-05-07 20:14 Sheryl Wang 阅读(87) 评论(0) 推荐(0) 编辑

Length of Last Word

摘要: 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-05-07 17:49 Sheryl Wang 阅读(150) 评论(0) 推荐(0) 编辑

2016年5月6日

Path Sum II

摘要: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For example:Given the below binary tree and sum 阅读全文

posted @ 2016-05-06 20:21 Sheryl Wang 阅读(137) 评论(0) 推荐(0) 编辑

2016年5月5日

Valid Sudoku

摘要: Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit 阅读全文

posted @ 2016-05-05 14:52 Sheryl Wang 阅读(138) 评论(0) 推荐(0) 编辑

Longest Palindromic Substring

摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文

posted @ 2016-05-05 14:31 Sheryl Wang 阅读(107) 评论(0) 推荐(0) 编辑

Count and Say

摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文

posted @ 2016-05-05 14:23 Sheryl Wang 阅读(112) 评论(0) 推荐(0) 编辑

导航