随笔分类 -  leetcode

摘要:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ... 阅读全文
posted @ 2015-04-16 22:24 neuzxy 阅读(171) 评论(0) 推荐(0)
摘要:Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18]... 阅读全文
posted @ 2015-04-06 16:50 neuzxy 阅读(150) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2015-04-02 14:34 neuzxy 阅读(210) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =... 阅读全文
posted @ 2015-04-02 14:27 neuzxy 阅读(199) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-04-02 14:22 neuzxy 阅读(100) 评论(0) 推荐(0)
摘要:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two nu... 阅读全文
posted @ 2015-04-02 11:36 neuzxy 阅读(181) 评论(0) 推荐(0)
摘要:Implement pow(x,n).二分法,注意n为负数的处理。class Solution {public: double power(double x, int n) { if (n == 0) return 1; ... 阅读全文
posted @ 2015-03-24 13:14 neuzxy 阅读(116) 评论(0) 推荐(0)
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-02-07 19:47 neuzxy 阅读(152) 评论(0) 推荐(0)
摘要:Spiral Matrix IIGiven an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example,Given n = 3,You should ret... 阅读全文
posted @ 2015-02-07 16:34 neuzxy 阅读(134) 评论(0) 推荐(0)
摘要:Spiral MatrixGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following ... 阅读全文
posted @ 2015-02-07 15:45 neuzxy 阅读(187) 评论(0) 推荐(0)