摘要:
题目: Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Given two strings S and T, determine if they are both one edit distance apart. 链接: http://leetcode.com/problems/one-edit-distance/ 题解: 求两个字符串是否只有1 阅读全文
摘要:
题目: 链接: http://leetcode.com/problems/intersection-of-two-linked-lists/ 题解: 题目理解起来比较容易,两个单链表求交叉点。数学上来讲使用两个runner,一个链表走完以后继续走另外一个链表,假如有交叉点则两个节点相等的时候正好走了 阅读全文
摘要:
题目: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... 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip i 阅读全文
摘要:
题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- R 阅读全文
摘要:
题目:Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Suppose a s... 阅读全文
摘要:
题目: 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 elem 阅读全文
摘要:
题目: 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, 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or anoth 阅读全文
摘要:
题目: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 链接: http://leetcode.com/problems/max-points-on 阅读全文
摘要:
题目: Sort a linked list in O(n log n) time using constant space complexity. 链接: http://leetcode.com/problems/sort-list/ 题解: Sort List, 链表排序,一看到O(nlogn) 阅读全文
摘要:
题目: Sort a linked list using insertion sort. Hide Tags Linked List Sort Sort a linked list using insertion sort. Hide Tags Linked List Sort Sort a lin 阅读全文
摘要:
题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get 阅读全文
摘要:
题目: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [3,2,1]. Note: Recursive 阅读全文