CODE 50: Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Give...

2013-09-29 22:44:54

阅读数:447

评论数:0

CODE 51: 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. Giv...

2013-09-29 22:04:44

阅读数:366

评论数:0

CODE 48: Maximal Rectangle

Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. public int maximalRectangle...

2013-09-28 22:06:31

阅读数:305

评论数:0

CODE 49:Largest Rectangle in Histogram

public int largestRectangleArea(int[] height) { // Start typing your Java solution below // DO NOT write main() function if (null == height || ...

2013-09-27 23:30:26

阅读数:428

评论数:0

CODE 47: Partition List

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve ...

2013-09-25 22:30:06

阅读数:579

评论数:0

CODE 45: Merge Sorted Array

Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space to hold additional elemen...

2013-09-23 22:43:47

阅读数:318

评论数:0

CODE 44: Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total...

2013-09-22 22:52:19

阅读数:420

评论数:0

CODE 43: Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given ...

2013-09-22 21:55:13

阅读数:378

评论数:0

CODE 40: Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135&q...

2013-09-21 21:09:27

阅读数:444

评论数:0

CODE 39: Submission Details

Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3...

2013-09-21 20:00:05

阅读数:475

评论数:0

CODE 46: Scramble String

Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representa...

2013-09-21 19:51:04

阅读数:593

评论数:0

CODE 37: Unique Binary Search Trees II

Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should retu...

2013-09-21 11:01:06

阅读数:501

评论数:0

CODE 38: Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BS...

2013-09-21 10:40:34

阅读数:468

评论数:0

CODE 36: Interleaving String

Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca"...

2013-09-20 23:36:14

阅读数:457

评论数:0

CODE 35: Validate Binary Search Tree

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 contai...

2013-09-20 21:39:24

阅读数:547

评论数:0

CODE 26: Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). ...

2013-09-20 19:38:56

阅读数:596

评论数:0

CODE 34: Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) sp...

2013-09-20 19:33:34

阅读数:738

评论数:0

CODE 33: Same Tree

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...

2013-09-20 18:35:57

阅读数:625

评论数:0

CODE 32: Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 ...

2013-09-20 18:30:19

阅读数:585

评论数:0

CODE 31: Binary Tree Level Order Traversal

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 tre...

2013-09-20 18:08:53

阅读数:572

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭