2015年3月15日

Merge Intervals

摘要: Merge Intervals问题:Given a collection of intervals, merge all overlapping intervals.思路: 不排序 直接上根据交集的特性 排序后再判断 简单的数学推导我的代码1:public class Solution { ... 阅读全文

posted @ 2015-03-15 20:40 zhouzhou0615 阅读(147) 评论(0) 推荐(0) 编辑

Unique Binary Search Trees II

摘要: Unique Binary Search Trees II问题:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.思路: dfs或者动态规划我的代码:public c... 阅读全文

posted @ 2015-03-15 19:37 zhouzhou0615 阅读(209) 评论(0) 推荐(0) 编辑

Longest Common Prefix

摘要: Longest Common Prefix问题:Write a function to find the longest common prefix string amongst an array of strings.思路: 简单的string运算我的代码:public class Soluti... 阅读全文

posted @ 2015-03-15 17:04 zhouzhou0615 阅读(118) 评论(0) 推荐(0) 编辑

Anagrams

摘要: Anagrams问题:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.思路: Anagrams:排序后的String作为... 阅读全文

posted @ 2015-03-15 16:10 zhouzhou0615 阅读(140) 评论(0) 推荐(0) 编辑

Letter Combinations of a Phone Number

摘要: Letter Combinations of a Phone Number问题:iven a digit string, return all possible letter combinations that the number could represent.A mapping of digi... 阅读全文

posted @ 2015-03-15 15:48 zhouzhou0615 阅读(196) 评论(0) 推荐(0) 编辑

Binary Tree Level Order Traversal

摘要: Binary Tree Level Order Traversal问题: Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, lev... 阅读全文

posted @ 2015-03-15 15:18 zhouzhou0615 阅读(138) 评论(0) 推荐(0) 编辑

Copy List with Random Pointer

摘要: Copy List with Random Pointer问题:A linked list is given such that each node contains an additional random pointer which could point to any node in the ... 阅读全文

posted @ 2015-03-15 11:51 zhouzhou0615 阅读(210) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted List II

摘要: Remove Duplicates from Sorted List II问题:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the... 阅读全文

posted @ 2015-03-15 11:21 zhouzhou0615 阅读(114) 评论(0) 推荐(0) 编辑

Min Stack

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

posted @ 2015-03-15 10:52 zhouzhou0615 阅读(108) 评论(0) 推荐(0) 编辑

导航