LeetCode+
yuanhisn
这个作者很懒,什么都没留下…
展开
-
LeetCode 157 - Read N Characters Given Read4
The API: int read4(char *buf) reads 4 characters at a time from a file.The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the f...原创 2015-02-23 11:39:56 · 44 阅读 · 0 评论 -
LeetCode 158 - Read N Characters Given Read4 II - Call multiple times
The API: int read4(char *buf) reads 4 characters at a time from a file.The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the f...原创 2015-02-23 11:40:17 · 71 阅读 · 0 评论 -
LeetCode 170 - Two Sum III - Data structure design
Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find - Find if there exists any pair of numbers wh...原创 2015-02-23 11:41:04 · 71 阅读 · 0 评论 -
LeetCode 161 - One Edit Distance
Given two strings S and T, determine if they are both one edit distance apart. Hint:1. If | n – m | is greater than 1, we know immediately both are not one-edit distance apart.2. It might help if y...原创 2015-02-24 02:04:27 · 60 阅读 · 0 评论 -
LeetCode 159 - Longest Substring with At Most Two Distinct Characters
Given a string S, find the length of the longest substring T that contains at most two distinct characters.For example,Given S = “eceba”,T is “ece” which its length is 3. [分析]brute force的解法就是构造出来所有...原创 2015-03-09 10:44:40 · 63 阅读 · 0 评论 -
LeetCode 163 - Missing Ranges
Given a sorted integer array where the range of elements are [0, 99] inclusive, return its missing ranges.For example, given [0, 1, 3, 50, 75], return [“2”, “4->49”, “51->74”, “76->99”] 这也...原创 2015-03-09 10:44:54 · 83 阅读 · 0 评论