原创 leetcode 26[easy]--- Remove Duplicates from Sorted Array

難度:easyGiven a sorted array, remove the duplicates in-place such that each element appear only once and return the new

原创 leetcode 34[medium]---Search for a Range

難度:mediumGiven an array of integers sorted in ascending order, find the starting and ending position of a given target

原创 leetcode 520[easy]---Detect Capital

難度:easy Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of c

原创 leetcode 118[easy]---Pascal's Triangle

難度:easy Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return 思路:帕斯

原创 leetcode 33[medium]---Search in Rotated Sorted Array

難度:medium Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1

原创 leetcode 229[medium]--- Majority Element II

難度:medium Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm shou

原创 leetcode 228[medium]---Summary Ranges--兩個while循環,反覆看。

難度:medium 思路:題意很簡單,不多講。借鑑別人的code,膜拜這種用兩個while循環,將變態與靜態分開的數分開的寫法。

原创 leetcode80[medium]--Remove Duplicates from Sorted Array II

難度:medium Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted

原创 leetcode 605[easy]---Can Place Flowers

難度:easy Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers

原创 leetcode 367[easy]----Valid Perfect Square

難度:easy Given a positive integer num, write a function which returns True if num is a perfect square else False. Not

原创 leetcode 551[easy]-- Student Attendance Record I

You are given a string representing an attendance record for a student. The record only contains the following three c

原创 leetcode 485[easy]---Max Consecutive Ones

Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output

原创 leetcode 153[medium]---Find Minimum in Rotated Sorted Array

難度:easy Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2

原创 leetcode 495[medium]----Teemo Attacking

難度:medium In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned conditi

原创 leetcode 581[easy]---- Shortest Unsorted Continuous Subarray

難度:easy Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascen