
leetCode
yaxi_wx
这个作者很懒,什么都没留下…
展开
-
LeetCode -- ReverseWordsinaString
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".这里有两种qing原创 2014-07-15 20:24:35 · 357 阅读 · 0 评论 -
LeetCode -- InsertionSor List
Sort a linked list using insertion sort./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x;原创 2014-07-17 22:38:49 · 438 阅读 · 0 评论 -
LeetCode -- singleNumber
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e原创 2014-07-10 23:07:56 · 358 阅读 · 0 评论 -
LeetCode -- sameTree
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-07-10 23:19:47 · 455 阅读 · 0 评论 -
LeetCode -- maxDepth
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.比较左右子树的高度,选最高的叠加原创 2014-07-10 23:14:19 · 489 阅读 · 0 评论 -
LeetCode -- LinkedListCycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?原创 2014-07-14 22:12:53 · 393 阅读 · 0 评论 -
LeetCode -- UniqueBinarySearchTrees
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.当n = 0 时为空树,所以BST的个数为1当n = 1 时只有一个节点,原创 2014-07-14 21:12:19 · 365 阅读 · 0 评论 -
LeetCode -- ReverseInteger
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321原创 2014-07-14 19:30:32 · 363 阅读 · 0 评论