leetcode
fresh_suger
永远年轻,永远热泪盈眶
展开
-
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 ; ot原创 2017-01-15 16:17:28 · 366 阅读 · 0 评论 -
121. Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2017-03-05 20:56:56 · 289 阅读 · 0 评论 -
122. Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on原创 2017-03-05 22:58:19 · 226 阅读 · 0 评论 -
171. Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ...原创 2017-03-03 23:28:14 · 205 阅读 · 0 评论 -
168. Excel Sheet Column Title
168. Excel Sheet Column Title Add to List Description Submission Solutions Total Accepted: 92486Total Submissions: 371421Difficulty: EasyContributors: Admin Given a positiv原创 2017-03-03 23:05:41 · 200 阅读 · 0 评论 -
506. 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-13 21:39:19 · 345 阅读 · 0 评论 -
504. Base 7
Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" Example 2: Input: -7 Output: "-10" Note: The input will be in range of [-1e7, 1e7].原创 2017-03-01 21:44:05 · 222 阅读 · 0 评论 -
167. 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-02-13 12:23:47 · 260 阅读 · 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. Example 1: Input: ["Hello", "Alaska", "Da原创 2017-02-11 22:33:55 · 913 阅读 · 0 评论 -
492. Construct the Rectangle
For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L原创 2017-02-28 22:46:12 · 264 阅读 · 0 评论 -
387. First Unique Character in a String
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note:原创 2017-01-20 12:08:29 · 319 阅读 · 0 评论 -
349. Intersection of Two Arrays
Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element in the result must be unique.The res原创 2017-01-20 11:21:25 · 209 阅读 · 0 评论 -
520. 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-28 11:52:31 · 447 阅读 · 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's elements in the corresponding places of nums原创 2017-02-28 11:09:32 · 184 阅读 · 0 评论 -
485. 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: 3 Explanation: The first two digits or the last three digits are consecutiv原创 2017-01-16 11:06:38 · 297 阅读 · 0 评论 -
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). The grid is completely原创 2017-01-15 16:59:14 · 262 阅读 · 0 评论 -
453. Minimum Moves to Equal Array Elements
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1. Example: Input: [1,2,3] Ou原创 2017-01-15 15:34:19 · 183 阅读 · 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 min(ai, bi) for all i from 1 to n as large原创 2017-05-20 17:24:37 · 219 阅读 · 0 评论