随笔分类 -  LeetCode

上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 61 下一页
摘要:Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algor 阅读全文
posted @ 2016-10-06 14:11 Grandyang 阅读(25219) 评论(26) 推荐(1)
摘要:Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. L 阅读全文
posted @ 2016-10-05 10:45 Grandyang 阅读(14857) 评论(2) 推荐(0)
摘要:Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation. A string such as "word" contains o 阅读全文
posted @ 2016-10-04 13:09 Grandyang 阅读(10621) 评论(0) 推荐(0)
摘要:Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to 阅读全文
posted @ 2016-10-03 12:32 Grandyang 阅读(20435) 评论(14) 推荐(7)
摘要:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers(h, k), where h is the height of the perso 阅读全文
posted @ 2016-10-02 23:58 Grandyang 阅读(20868) 评论(11) 推荐(1)
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2: 阅读全文
posted @ 2016-10-01 23:53 Grandyang 阅读(8769) 评论(7) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: 这道题让我们求一棵二叉树的所有左子叶的和,那么看到这道题我们知道这肯定是考二叉树的遍历问题,那么最简洁的写法肯定是用递归,由于我们只需要累加左子叶之和,那么我们在进入递归 阅读全文
posted @ 2016-09-30 13:40 Grandyang 阅读(9991) 评论(1) 推荐(0)
摘要:A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents 阅读全文
posted @ 2016-09-22 15:10 Grandyang 阅读(11307) 评论(6) 推荐(0)
摘要:Given an integer n, return the nth digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]. Example 1: Input: n = 3 Output: 3 阅读全文
posted @ 2016-09-21 10:59 Grandyang 阅读(13858) 评论(1) 推荐(1)
摘要:A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but i 阅读全文
posted @ 2016-09-20 13:16 Grandyang 阅读(18892) 评论(13) 推荐(0)
摘要:Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
posted @ 2016-09-19 04:04 Grandyang 阅读(18509) 评论(4) 推荐(3)
摘要:Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given 阅读全文
posted @ 2016-09-17 23:59 Grandyang 阅读(18690) 评论(10) 推荐(2)
摘要:Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number m 阅读全文
posted @ 2016-09-15 21:45 Grandyang 阅读(14727) 评论(7) 推荐(0)
摘要:Given a positive integer n and you can do operations as follow: What is the minimum number of replacements needed for n to become 1? Example 1: Exampl 阅读全文
posted @ 2016-09-14 20:57 Grandyang 阅读(9223) 评论(6) 推荐(0)
摘要:Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a 阅读全文
posted @ 2016-09-13 21:02 Grandyang 阅读(8833) 评论(4) 推荐(2)
摘要:There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach 阅读全文
posted @ 2016-09-10 23:36 Grandyang 阅读(10548) 评论(3) 推荐(0)
摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than 阅读全文
posted @ 2016-09-08 11:13 Grandyang 阅读(19621) 评论(19) 推荐(1)
摘要:Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is be 阅读全文
posted @ 2016-09-07 13:01 Grandyang 阅读(31002) 评论(12) 推荐(1)
摘要:A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: This is how the UTF-8 encoding would work: Given an array of inte 阅读全文
posted @ 2016-09-06 23:22 Grandyang 阅读(13333) 评论(7) 推荐(1)
摘要:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is po 阅读全文
posted @ 2016-09-05 13:57 Grandyang 阅读(13696) 评论(3) 推荐(0)

上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 61 下一页
Fork me on GitHub