leetcode 605. Can Place Flowers
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they
阅读全文
posted @
2017-07-29 10:17
Beserious
阅读(374)
推荐(0) 编辑
leetcode 219. 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
阅读全文
posted @
2017-07-29 09:35
Beserious
阅读(149)
推荐(0) 编辑
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. For example, giv
阅读全文
posted @
2017-07-28 17:21
Beserious
阅读(151)
推荐(0) 编辑
leetcode 217. Contains Duplicate
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr
阅读全文
posted @
2017-07-28 16:34
Beserious
阅读(196)
推荐(0) 编辑
leetcode 628. Maximum Product of Three Numbers
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 排序,然后前后枚举一下就行了 3种情况。 或
阅读全文
posted @
2017-07-28 16:22
Beserious
阅读(143)
推荐(0) 编辑
leetcode 268. Missing Number
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1,
阅读全文
posted @
2017-07-28 16:03
Beserious
阅读(140)
推荐(0) 编辑
448. 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]
阅读全文
posted @
2017-07-28 15:58
Beserious
阅读(146)
推荐(0) 编辑
leetcode 485. Max Consecutive Ones
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length
阅读全文
posted @
2017-07-28 12:09
Beserious
阅读(144)
推荐(0) 编辑
496. Next Greater Element I
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1'
阅读全文
posted @
2017-07-28 11:39
Beserious
阅读(132)
推荐(0) 编辑
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/ve
阅读全文
posted @
2017-07-28 10:19
Beserious
阅读(133)
推荐(0) 编辑
leetcode 637. Average of Levels in Binary Tree
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Note:
阅读全文
posted @
2017-07-28 10:03
Beserious
阅读(165)
推荐(0) 编辑
412. Fizz Buzz
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe
阅读全文
posted @
2017-07-28 09:55
Beserious
阅读(177)
推荐(0) 编辑
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.
阅读全文
posted @
2017-07-28 09:42
Beserious
阅读(155)
推荐(0) 编辑
leetcode 575. Distribute Candies
摘要:Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of th
阅读全文
posted @
2017-07-28 09:32
Beserious
阅读(219)
推荐(0) 编辑
344. Reverse String
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 反转字符串,逼我不用 reverse
阅读全文
posted @
2017-07-27 22:02
Beserious
阅读(84)
推荐(0) 编辑
557. 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. E
阅读全文
posted @
2017-07-27 21:40
Beserious
阅读(160)
推荐(0) 编辑
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. Examp
阅读全文
posted @
2017-07-27 21:21
Beserious
阅读(157)
推荐(0) 编辑
476. Number Complement
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: Example 1: Exa
阅读全文
posted @
2017-07-27 20:15
Beserious
阅读(134)
推荐(0) 编辑
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
阅读全文
posted @
2017-07-27 19:45
Beserious
阅读(116)
推荐(0) 编辑
617. 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 n
阅读全文
posted @
2017-07-27 17:04
Beserious
阅读(145)
推荐(0) 编辑