2015年3月14日

Compare Version Numbers

摘要: Compare Version Numbers问题:Compare two version numbersversion1andversion2.Ifversion1>version2return 1, ifversion1 two) return 1; if(one v2.... 阅读全文

posted @ 2015-03-14 20:32 zhouzhou0615 阅读(138) 评论(0) 推荐(0) 编辑

Excel Sheet Column Title

摘要: Excel Sheet Column Title问题:Given a positive integer, return its corresponding column title as appear in an Excel sheet.思路: 进制访问问题我的代码:public class So... 阅读全文

posted @ 2015-03-14 20:06 zhouzhou0615 阅读(114) 评论(0) 推荐(0) 编辑

Binary Tree Zigzag Level Order Traversal

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

posted @ 2015-03-14 17:54 zhouzhou0615 阅读(153) 评论(0) 推荐(0) 编辑

Minimum Depth of Binary Tree

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

posted @ 2015-03-14 16:09 zhouzhou0615 阅读(155) 评论(0) 推荐(0) 编辑

Pow(x, n)

摘要: Pow(x, n)问题: Implement pow(x,n).思路: 分治法我的代码:public class Solution { public double pow(double x, int n) { return n >= 0 ? helper(x,n) : 1/h... 阅读全文

posted @ 2015-03-14 16:01 zhouzhou0615 阅读(139) 评论(0) 推荐(0) 编辑

Reverse Bits

摘要: Reverse Bits问题:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010000011110100... 阅读全文

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

Jump Game

摘要: Jump Game问题:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents... 阅读全文

posted @ 2015-03-14 14:19 zhouzhou0615 阅读(147) 评论(0) 推荐(0) 编辑

Valid Palindrome

摘要: Valid Palindrome问题:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.思路: 简单的数学推导我的代码:publi... 阅读全文

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

Reverse Linked List II

摘要: Reverse Linked List II问题:Reverse a linked list from positionmton. Do it in-place and in one-pass.思路: 三行情书,用的飞起我的代码:public class Solution { public ... 阅读全文

posted @ 2015-03-14 13:27 zhouzhou0615 阅读(144) 评论(0) 推荐(0) 编辑

Insertion Sort List

摘要: Insertion Sort List问题:Sort a linked list using insertion sort.思路: 三行情书 旧旧 新 旧 旧 新我的代码:/** * Definition for singly-linked list. * public class ListNod... 阅读全文

posted @ 2015-03-14 13:13 zhouzhou0615 阅读(120) 评论(0) 推荐(0) 编辑

Palindrome Partitioning

摘要: Palindrome Partitioning问题:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partiti... 阅读全文

posted @ 2015-03-14 12:59 zhouzhou0615 阅读(149) 评论(0) 推荐(0) 编辑

Construct Binary Tree from Preorder and Inorder Traversal

摘要: Construct Binary Tree from Preorder and Inorder Traversal问题:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may ass... 阅读全文

posted @ 2015-03-14 12:46 zhouzhou0615 阅读(126) 评论(0) 推荐(0) 编辑

导航