- 博客(71)
- 收藏
- 关注
原创 LeetCode 643. Maximum Average Subarray I
Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the maximum average value.
2017-07-21 19:38:34
663
原创 LeetCode 55. Jump Game
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 maximum jump length at that position.
2017-07-18 20:39:03
453
原创 LeetCode 633. Sum of Square Numbers
Given a non-negative integer c, your task is to decide whether there’re two integers a and b such that a2+b2=ca^2 + b^2 = c.
2017-07-15 10:28:01
340
原创 LeetCode 338. Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.
2017-04-28 15:17:23
332
原创 LeetCode 345. Reverse Vowels of a String
Write a function that takes a string as input and reverse only the vowels of a string.
2017-04-27 12:45:20
505
原创 LeetCode 561. 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 large as possible.
2017-04-26 08:35:29
690
原创 LeetCode 258. Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
2017-04-23 15:53:11
460
原创 LeetCode 100. 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.
2017-04-23 10:42:33
328
原创 LeetCode 217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates.
2017-04-22 12:00:18
267
原创 LeetCode 283. Move Zeroes
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.
2017-04-22 11:34:50
267
原创 LeetCode 73. 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.
2017-04-22 11:27:02
270
原创 LeetCode 35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
2017-04-17 23:52:00
374
原创 LeetCode 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
2017-04-17 23:28:20
378
原创 LeetCode 551. Student Attendance Record I
DescriptionYou 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 r
2017-04-17 17:11:21
577
原创 LeetCode 521. Longest Uncommon Subsequence I
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings.
2017-04-16 10:54:55
467
原创 LeetCode 556. Next Greater Element III
Given a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly the same digits existing in the integer n and is greater in value than n.
2017-04-10 15:55:07
820
原创 LeetCode 482. 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.
2017-04-10 08:54:12
1360
原创 LeetCode 228. Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.
2017-04-09 13:56:07
285
原创 LeetCode 66. Plus One
DescriptionGiven a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The di
2017-04-08 08:52:26
249
原创 LeetCode 101. Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
2017-04-07 12:48:48
239
原创 LeetCode 485. Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array.
2017-04-07 09:21:08
203
原创 LeetCode 342. Power of Four
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
2017-04-06 22:46:29
206
原创 LeetCode 396. Rotate Function
Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise
2017-04-05 20:20:50
245
原创 LeetCode 191. Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of'1'bits it has (also known as the Hamming weight).
2017-04-05 19:13:23
234
原创 LeetCode 189. Rotate Array
Rotate an array of n elements to the right by k steps.
2017-04-04 11:07:20
252
原创 LeetCode 263. Ugly Number
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.
2017-04-04 09:23:50
223
原创 LeetCode 367. Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.
2017-04-04 09:08:23
281
原创 LeetCode 374. Guess Number Higher or Lower
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked.
2017-04-04 08:45:18
252
原创 LeetCode 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines.
2017-04-04 08:16:11
333
原创 LeetCode 434. Number of Segments in a String
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.
2017-04-04 08:08:11
236
原创 LeetCode 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
2017-04-03 22:35:24
192
原创 LeetCode 67. Add Binary
Given two binary strings, return their sum (also a binary string).
2017-04-03 22:02:25
198
原创 LeetCode 541. Reverse String II
Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string.
2017-04-03 09:58:38
239
原创 LeetCode 122. Best Time to Buy and Sell Stock II
Say you have an array for which the ithi^{th} element is the price of a given stock on day ii.Design an algorithm to find the maximum profit. You may complete as many transactions as you like
2017-04-03 00:10:31
211
原创 LeetCode 492. Construct the Rectangle
For a web developer, it is very important to know how to design a web page’s size.
2017-04-02 17:40:55
285
原创 LeetCode 500. 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.
2017-04-02 17:07:04
169
原创 LeetCode 463. 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).
2017-04-01 19:06:24
176
原创 LeetCode 344. Reverse String
Write a function that takes a string as input and returns the string reversed.
2017-04-01 09:53:32
180
原创 LeetCode 223. Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
2017-03-30 11:39:02
186
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人