LeetCode
卖鱼的哲学
这个作者很懒,什么都没留下…
展开
-
Leetcode----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 and the nodes have the same value.非递原创 2014-12-06 11:08:39 · 226 阅读 · 0 评论 -
LeetCode----SingerNumer,奋斗的开始~
准备开始刷LeetCOde,为下学期的找工作做准备(基础太不扎实了。。举步维艰)第一道,AC率最高的一道:Single Number Total Accepted: 46425 Total Submissions: 101039 My Submissions Question Solution Given an array of integers, every element appe原创 2014-12-05 20:36:29 · 244 阅读 · 0 评论 -
LeetCode----Maximum Depth of Binary Tree
这题比较简单,简单的递归下就完事了,难怪排AC第二高的,感觉比AC第一高的容易多了public int maxDepth(TreeNode root){if(root==null)return 0;int result=FindDepth(root,1);return result;}public static int FindDepth(TreeNode ro原创 2014-12-05 21:37:48 · 308 阅读 · 0 评论 -
LeetCode------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 find the maximum profit. You may complete as many transactions as you like (ie, buy原创 2014-12-06 15:06:34 · 238 阅读 · 0 评论 -
LeetCode-----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 BST's. 1 3 3 2 1原创 2014-12-06 15:48:40 · 255 阅读 · 0 评论 -
LeetCode-----Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?刚开始没看见下面不用额外空间的话,用set搞了个:public static boolean hasCycle(ListNode head){ListNod原创 2014-12-06 19:02:02 · 302 阅读 · 0 评论 -
LeetCode----将代码放到github上了
准备以后直接将代码放到github上,项目地址:https://github.com/tangzhiyi11/LeetCode-eclipse原创 2014-12-07 19:19:04 · 3691 阅读 · 0 评论