随笔分类 -  Leetcode

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Runtime: 59ms Runtime: 92ms 阅读全文
posted @ 2016-09-29 05:41 amazingzoe 阅读(94) 评论(0) 推荐(0)
摘要:Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
posted @ 2016-09-29 04:05 amazingzoe 阅读(135) 评论(0) 推荐(0)
摘要:Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequen 阅读全文
posted @ 2016-09-28 02:45 amazingzoe 阅读(614) 评论(0) 推荐(0)
摘要:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". Update (2015-02-12):For C pr 阅读全文
posted @ 2016-09-24 05:29 amazingzoe 阅读(125) 评论(0) 推荐(0)
摘要:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not 阅读全文
posted @ 2016-09-22 11:39 amazingzoe 阅读(92) 评论(0) 推荐(0)
摘要:Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does not contain lea 阅读全文
posted @ 2016-09-22 11:33 amazingzoe 阅读(116) 评论(0) 推荐(0)
摘要:An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: a) it --> it (no abbrev 阅读全文
posted @ 2016-09-22 06:06 amazingzoe 阅读(210) 评论(0) 推荐(0)
摘要:Given a string, determine if a permutation of the string could form a palindrome. For example,"code" -> False, "aab" -> True, "carerac" -> True. Analy 阅读全文
posted @ 2016-09-20 11:31 amazingzoe 阅读(168) 评论(0) 推荐(0)
摘要:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f 阅读全文
posted @ 2016-09-20 06:26 amazingzoe 阅读(151) 评论(0) 推荐(0)
摘要:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文
posted @ 2016-09-20 05:59 amazingzoe 阅读(232) 评论(0) 推荐(0)
摘要:Description: Count the number of prime numbers less than a non-negative number, n. Analyse: start from 2, label 2 * 2, 2 * 3... as false; then move to 阅读全文
posted @ 2016-09-20 04:23 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要:Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文
posted @ 2016-09-20 00:50 amazingzoe 阅读(124) 评论(0) 推荐(0)
摘要: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 or 阅读全文
posted @ 2016-09-19 05:18 amazingzoe 阅读(109) 评论(0) 推荐(0)
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use extra sp 阅读全文
posted @ 2016-09-19 05:06 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要:Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the or 阅读全文
posted @ 2016-09-19 02:19 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2016-09-19 01:22 amazingzoe 阅读(121) 评论(0) 推荐(0)
摘要: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 maxim 阅读全文
posted @ 2016-09-19 01:15 amazingzoe 阅读(146) 评论(0) 推荐(0)
摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2016-09-19 00:35 amazingzoe 阅读(121) 评论(0) 推荐(0)
摘要:Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + 阅读全文
posted @ 2016-09-17 23:23 amazingzoe 阅读(160) 评论(0) 推荐(0)
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 阅读全文
posted @ 2016-09-16 03:43 amazingzoe 阅读(126) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页