自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 [LeetCode OJ]75. Sort Colors

Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers

2016-08-26 15:25:19 388

原创 [LeetCode OJ]59. Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [

2016-08-26 14:47:33 362

原创 [LeetCode OJ]167. Two Sum II - Input array is sorted

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two number

2016-08-25 23:25:36 175

原创 [LeetCode OJ]216. Combination Sum III

Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.求出k个1~9数字组合之和为n的所有序列

2016-08-25 22:17:59 208

原创 [LeetCode OJ]Find Minimum in Rotated Sorted Array

https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array/起初感觉这题挺水的,不就是遍历一遍找到最小值么?水过后系统提示解锁了Solution,点进去一看发现是我自己比较水。。。人家给的是排序好的Array,你丫还O(n)不是丢人么。。。思路如下:数组[AL , AL+1,...,AR],如果没有

2016-06-30 22:27:24 248

原创 [LeetCode OJ]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 th

2013-11-14 23:58:21 447

原创 [LeetCode OJ]Single Number

Given an array of integers, every element appears twice except for one. Find that single one.求数组中唯一一个没有重复出现两次的数自己想了一会儿,没有好的想法,上网搜了下,只找到了找出没有重复出现的方法,一个很巧妙的方法是,利用异或算法:http://blog.csdn.net/

2013-11-14 23:30:26 601

原创 [LeetCode OJ]Maximum Depth of Binary Tree

一道简单的求二叉树的最大深度,还wrong了一次,没有考虑input为NULL的情况。。。附上code:/** * Definition for binary tree * struct TreeNode { *     int val; *     TreeNode *left; *     TreeNode *right; *     TreeNode(int

2013-11-14 22:32:42 511

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除