2015年3月4日

Search Insert Position

摘要: Search Insert Position 问题: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would b 阅读全文

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

Populating Next Right Pointers in Each Node

摘要: Populating Next Right Pointers in Each Node 问题: each next pointer to point to its next right node. If there is no next right node, the next pointer sh 阅读全文

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

Binary Tree Inorder Traversal

摘要: Binary Tree Inorder Traversal 问题: Given a binary tree, return the inorder traversal of its nodes' values. Recursive solution is trivial, could you do 阅读全文

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

Binary Tree Preorder Traversal

摘要: Binary Tree Preorder Traversal 问题: Given a binary tree, return the preorder traversal of its nodes' values. Recursive solution is trivial, could you d 阅读全文

posted @ 2015-03-04 14:53 zhouzhou0615 阅读(163) 评论(0) 推荐(0) 编辑

Linked List Cycle

摘要: Linked List Cycle 问题: Given a linked list, determine if it has a cycle in it. 思路: 快指针,慢指针方法 我的代码: public class Solution { public boolean hasCycle(List 阅读全文

posted @ 2015-03-04 14:47 zhouzhou0615 阅读(112) 评论(0) 推荐(0) 编辑

Excel Sheet Column Number

摘要: Excel Sheet Column Number 问题: Given a column title as appear in an Excel sheet, return its corresponding column number. 思路: 进制转换方法 我的代码: public class 阅读全文

posted @ 2015-03-04 14:35 zhouzhou0615 阅读(217) 评论(0) 推荐(0) 编辑

Unique Binary Search Trees

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

posted @ 2015-03-04 14:30 zhouzhou0615 阅读(111) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock II

摘要: Best Time to Buy and Sell Stock II 问题: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to 阅读全文

posted @ 2015-03-04 10:51 zhouzhou0615 阅读(154) 评论(0) 推荐(0) 编辑

Same Tree

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

posted @ 2015-03-04 10:45 zhouzhou0615 阅读(184) 评论(0) 推荐(0) 编辑

Maximum Depth of Binary Tree

摘要: Maximum Depth of Binary Tree 问题: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the 阅读全文

posted @ 2015-03-04 10:42 zhouzhou0615 阅读(111) 评论(0) 推荐(0) 编辑

Single Number

摘要: Single Number 问题: Given an array of integers, every element appears twice except for one. Find that single one. 思路: 异或 我的方法: public class Solution { p 阅读全文

posted @ 2015-03-04 10:37 zhouzhou0615 阅读(99) 评论(0) 推荐(0) 编辑

导航