摘要: 题目: Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. 阅读全文
posted @ 2017-02-21 06:17 panini 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2017-02-21 01:24 panini 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 链接: http://leetcode.com/problems/excel-s 阅读全文
posted @ 2017-02-21 00:54 panini 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 func 阅读全文
posted @ 2017-02-20 11:53 panini 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目: 链接: http://leetcode.com/problems/intersection-of-two-linked-lists/ 2/19/2017, Java 一开始的思路是,借用判断cycled linked list来。先从nodeA出发遍历,把最后一个node的next设为nod 阅读全文
posted @ 2017-02-20 11:27 panini 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2017-02-19 23:50 panini 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2017-02-19 04:43 panini 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 链接: http://leetcode.com/problems/lin 阅读全文
posted @ 2017-02-19 04:06 panini 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com 阅读全文
posted @ 2017-02-19 03:48 panini 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 题目: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co 阅读全文
posted @ 2017-02-18 23:59 panini 阅读(141) 评论(0) 推荐(0) 编辑