✡ leetcode 170. Two Sum III - Data structure design 设计two sum模式 --------- java
摘要:Design and implement a TwoSum class. It should support the following operations: add and find. Design and implement a TwoSum class. It should support
阅读全文
✡ leetcode 169. Majority Element 求出现次数最多的数 --------- java
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
✡ leetcode 168. Excel Sheet Column Title 26进制数字 --------- java
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 26进制的实现。 没什么难点。就是需要需要注意是 n = (n-1)/26
阅读全文
✡ leetcode 167. Two Sum II - Input array is sorted 求两数相加等于一个数的位置 --------- java
摘要: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
阅读全文
✡ leetcode 166. Fraction to Recurring Decimal 分数转换 --------- java
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating
阅读全文
✡ leetcode 165. Compare Version Numbers 比较两个字符串数字的大小 --------- java
摘要:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assum
阅读全文
✡ leetcode 164. Maximum Gap 寻找最大相邻数字差 --------- java
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/space. Return
阅读全文
✡ leetcode 163. Missing Ranges 找出缺失范围 --------- java
摘要:Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], return its missing ranges. For example, given [0,
阅读全文
✡ leetcode 161. One Edit Distance 判断两个字符串是否是一步变换 --------- java
摘要:Given two strings S and T, determine if they are both one edit distance apart. 给定两个字符串,判断他们是否是一步变换得到的。 在这里需要注意几点: 1、不等于1的变换都要返回false(包括变换次数等于0)。 2、还有很
阅读全文
✡ leetcode 159. Longest Substring with At Most Two Distinct Characters 求两个字母组成的最大子串长度 --------- java
摘要:Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example, Given s = “eceba”, T is "ece" whi
阅读全文
✡ leetcode 158. Read N Characters Given Read4 II - Call multiple times 对一个文件多次调用read(157题的延伸题) --------- java
摘要: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 retu
阅读全文
✡ leetcode 157. Read N Characters Given Read4 利用read4实现read --------- java
摘要: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 retu
阅读全文
✡ leetcode 156. Binary Tree Upside Down 旋转树 --------- java
摘要:156. Binary Tree Upside Down Add to List QuestionEditorial Solution My Submissions 156. Binary Tree Upside Down Add to List QuestionEditorial Solution
阅读全文
✡ leetcode 162. Find Peak Element --------- java
摘要:A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its inde
阅读全文
✡ leetcode 160. Intersection of Two Linked Lists 求两个链表的起始重复位置 --------- java
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in
阅读全文
leetcode 155. Min Stack --------- java
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov
阅读全文
leetcode 154. Find Minimum in Rotated Sorted Array II --------- java
摘要:Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a
阅读全文
leetcode 153. Find Minimum in Rotated Sorted Array --------- java
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element.
阅读全文
leetcode 152. Maximum Product Subarray --------- java
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t
阅读全文
leetcode 151. Reverse Words in a String --------- java
摘要: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
阅读全文