2015年3月5日

Maximum Subarray

摘要: Maximum Subarray 问题: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the a 阅读全文

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

Roman to Integer

摘要: Roman to Integer问题:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.思路:转换公式而已 前面的比自己大 相加 前面的比... 阅读全文

posted @ 2015-03-05 10:59 zhouzhou0615 阅读(137) 评论(0) 推荐(0) 编辑

第一次刷leetcode小结

摘要: LeetCode 上不会的Reverse IntegerGray CodeGenerate ParenthesesPascal's Triangle II 正方向读和反方向读保持不变的区别Trapping Rain Water 抓住数组的特性 可以排序 可以拿出最大值或者最小值来做参考Unique ... 阅读全文

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

N-Queens II

摘要: N-Queens II 问题: Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions 思路: 典型的DFS 阅读全文

posted @ 2015-03-05 10:39 zhouzhou0615 阅读(123) 评论(0) 推荐(0) 编辑

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) 编辑

导航