摘要:
题目: 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 阅读全文