自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 leetcode744: Find Smallest Letter Greater Than Target

Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target.Letters

2018-01-07 19:25:10 279

原创 leetcode745: Find Smallest Letter Greater Than Target

Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target.Letter

2018-01-03 19:23:47 261

原创 leetcode728: Self Dividing Numbers

要求:A self-dividing number is a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.Also, a

2017-12-28 20:36:31 262

原创 leetcode75: 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

2017-08-25 15:30:57 220

原创 leetcode654: Maximum Binary Tree

Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array.The left subtree is the maximum tree constructed f

2017-08-21 14:29:10 265

原创 leetcode657: Judge Route Circle

Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.The move sequence is represented

2017-08-20 20:03:46 167

原创 leetcode26: Remove Duplicates from Sorted Array

要求:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in pla

2017-07-05 19:56:14 154

原创 leetcode628: Maximum Product of Three Numbers

要求:Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6Example 2:Input: [1,2,3,4]Output: 24

2017-07-04 21:30:20 215

原创 leetcode561: Array Partition I

要求:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as

2017-07-03 20:12:34 209

原创 leetcode69: Sqrt(x)

要求:Implement int sqrt(int x).Compute and return the square root of x.注意:使用牛顿梯度法计算平方根,看百度百科或者维基百科 public int mySqrt(int x) { if (x== 0) return 0; double sol = 1; double res = 0

2017-07-02 20:56:12 145

原创 leetcode216: Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is a

2017-06-20 19:25:51 162

原创 leetcode507: Perfect Number

We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an integer n, write a function that returns true when it is a perf

2017-06-19 20:27:03 150

原创 leetcode624: Maximum Distance in Arrays

Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance betw

2017-06-18 17:04:53 363

原创 leetcode611: Valid Triangle Number

Given an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle.Example 1

2017-06-15 20:28:13 771

原创 leetcode617: Merge Two Binary Trees

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tr

2017-06-15 18:42:04 491

原创 leetcode 593: Valid Square

要求:Given the coordinates of four points in 2D space, return whether the four points could construct a square.The coordinate (x,y) of a point is represented by an integer array with two integer

2017-05-21 19:44:28 1270 2

原创 leetcode73:Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A straight forward solution using O(m

2017-05-19 16:33:11 176

原创 leetcode 581: Shortest Unsorted Continuous Subarray

Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to fin

2017-05-18 21:42:43 232

原创 leetcode 566: Reshape the Matrix

In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a matrix represented by a two-dim

2017-05-17 19:26:22 168

原创 leetcode151: Reverse Words in a String

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place 

2017-05-02 13:11:54 199

原创 leetcode345: Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".Note

2017-05-01 21:21:57 183

原创 leetcode344: Reverse String

Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".直接用StringBuffer中的reserve方法 public String reverseString(String s) {

2017-04-23 17:55:01 152

原创 leetocde557: Reverse Words in a String III

Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contes

2017-04-20 21:15:56 160

原创 leetcode404: Sum of Left Leaves

Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24

2017-04-18 20:44:13 183

原创 leetcode551: Student Attendance Record I

You are given a string representing an attendance record for a student. The record only contains the following three characters:'A' : Absent.'L' : Late.'P' : Present.A student could be

2017-04-18 20:18:06 425

原创 leetcode455: Assign Cookies

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a c

2017-04-06 19:50:53 144

原创 leetcode537: Complex Number Multiplication

Given two strings representing two complex numbers.You need to return a string representing their multiplication. Note i2 = -1 according to the definition.Example 1:Input: "1+1i", "1+1i"O

2017-04-06 19:25:33 271

原创 leetcode167: 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

2017-04-06 19:24:04 159

原创 leetcode171: Excel Sheet Column Number

Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 一开始用了一个笨方法。。

2017-03-02 21:55:32 187

原创 leetcode515: Find Largest Value in Each Tree Row

You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]广度优先搜索用队列,深度优先搜索用堆

2017-02-23 20:51:55 387

原创 leetcode448: Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.

2017-02-22 21:30:14 136

原创 leetcode520: Detect Capital

Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in t

2017-02-21 19:30:31 237

原创 leetcode463: Island Perimeter

You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely

2017-02-20 19:24:48 145

原创 leetcode398: Random Pick Index

Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c

2017-02-18 21:00:05 195

原创 leetcode504: Base 7

Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input will be in range of [-1e7, 1e

2017-02-15 19:07:25 248

原创 leetcode500: Keyboard Row

Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska", "Da

2017-02-14 20:32:35 297

原创 leetcode125: Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2017-02-13 19:26:46 166

原创 leetcode481: Magical String

A magical string S consists of only '1' and '2' and obeys the following rules:The string S is magical because concatenating the number of contiguous occurrences of characters '1' and '2' generates

2017-02-12 11:59:29 231

原创 leetcode482: License Key Formatting

Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and dashes. The dashes split the alphanumeric

2017-02-11 11:25:28 370

原创 leetcode506: Relative Ranks

Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal".Example 1:In

2017-02-10 22:11:40 849

空空如也

空空如也

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

TA关注的人

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