
LeetCode 循环技巧题
文章平均质量分 62
BoomHusky
计算机专业硕士,希望自己的实力能够更强
展开
-
LeetCode | 506. Relative Ranks
Givenscores of N athletes, find their relative ranks and the people with thetop three highest scores, who will be awarded medals: "Gold Medal","Silver Medal" and "Bronze Medal".Example1:Input:原创 2018-01-31 19:23:40 · 133 阅读 · 0 评论 -
LeetCode | 424. Longest Repeating Character Replacement循环剪枝题
Givena string that consists of only uppercase English letters, you can replace anyletter in the string with another letter at most ktimes.Find the length of a longest substring containing all repeatin...原创 2018-04-10 20:05:09 · 243 阅读 · 0 评论 -
LeetCode | 6. ZigZag Conversion 循环技巧题
Thestring "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows likethis: (you may want to display this pattern in a fixed font for betterlegibility)P A H NA P L S I原创 2018-01-30 16:50:01 · 155 阅读 · 0 评论 -
LeetCode | 121. Best Time to Buy and Sell Stock循环技巧题
Sayyou have an array for which the ith element is the price of a given stock on day i.Ifyou were only permitted to complete at most one transaction (ie, buy one andsell one share of the stock), de原创 2018-01-30 16:49:14 · 137 阅读 · 0 评论 -
LeetCode | 27. Remove Element贪心算法循环技巧题
Givenan array and a value, remove all instances of that value in-place andreturn the new length.Donot allocate extra space for another array, you must do this by modifying the input array in-place原创 2018-02-04 15:38:59 · 170 阅读 · 0 评论 -
LeetCode | 7. Reverse Integer 数字反向循环技巧题
Givena 32-bit signed integer, reverse digits of an integer.Example1:Input: 123Output: 321Example2:Input: -123Output: -321Example3:Input: 120Output: 21Note:Assume we a原创 2018-02-04 15:35:43 · 154 阅读 · 0 评论 -
LeetCode | 30. Substring with Concatenation of All Words字符串技巧难题
You are given a string, s,and a list of words, words,that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each wordin words exactly once and wit原创 2018-02-04 15:32:36 · 196 阅读 · 0 评论 -
LeetCode | 448. Find All Numbers Disappeared in an Array 数组技巧题
Givenan array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and othersappear once.Findall the elements of [1, n] inclusive that do not appear inthis array.Couldy原创 2018-02-04 15:29:08 · 138 阅读 · 0 评论 -
LeetCode | 717. 1-bit and 2-bit Characters水题
canbe represented by two bits (10 or 11).Nowgiven a string represented by several bits. Return whether the last charactermust be a one-bit character or not. The given string will always end with aze原创 2018-02-02 12:55:51 · 266 阅读 · 0 评论 -
LeetCode | 27. Remove Element循环技巧题
Givenan array and a value, remove all instances of that value in-place and return the new length.Donot allocate extra space for another array, you must do this by modifying the input array in-plac原创 2018-02-02 12:54:29 · 144 阅读 · 0 评论 -
Leetcode | 16. 3Sum Closest twoPoint方法拓展
Givenan array nums of n integers and an integer target, find three integers in nums such that the sum is closestto target. Return thesum of the three integers. You may assume that each input would hav...原创 2018-06-19 17:52:05 · 200 阅读 · 0 评论