2016年3月9日

83. Remove Duplicates from Sorted List

摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce. For example, Given1->1->2, return1->2. Given1->1->2->3->3, return1->2->3. 结题报告: 水... 阅读全文

posted @ 2016-03-09 09:14 olive_lv 阅读(114) 评论(0) 推荐(0)

2016年3月2日

206. Reverse Linked List

摘要: Reverse a singly linked list. 解题思路: 求一个链表的逆序。一种方法是遍历链表,将节点保存到stack中,在一个个出栈加到链表中;另一个方法是遍历链表,将每个节点插入到队首。。 C++ 8ms /** * Definition for singly-linked lis 阅读全文

posted @ 2016-03-02 17:10 olive_lv 阅读(254) 评论(0) 推荐(0)

144. Binary Tree Preorder Traversal

摘要: Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, return [1,2,3]. 解题思路: 题目很简单,就是求一个二叉 阅读全文

posted @ 2016-03-02 17:10 olive_lv 阅读(122) 评论(0) 推荐(0)

169. Majority Element

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

posted @ 2016-03-02 17:09 olive_lv 阅读(136) 评论(0) 推荐(0)

268. Missing Number

摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 阅读全文

posted @ 2016-03-02 17:09 olive_lv 阅读(138) 评论(0) 推荐(0)

2016年2月29日

242. Valid Anagram

摘要: Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t 阅读全文

posted @ 2016-02-29 08:32 olive_lv 阅读(132) 评论(0) 推荐(0)

238. Product of Array Except Self

摘要: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except  阅读全文

posted @ 2016-02-29 08:32 olive_lv 阅读(136) 评论(0) 推荐(0)

2016年2月26日

260. Single Number III

摘要: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文

posted @ 2016-02-26 08:53 olive_lv 阅读(143) 评论(0) 推荐(0)

2016年2月25日

Map之HashMap源码分析

摘要: public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable HashMap继承自AbstractMap,实现了Map接口,有map的基本操作;实现了Cloneable接 阅读全文

posted @ 2016-02-25 20:36 olive_lv 阅读(203) 评论(0) 推荐(0)

2016年2月22日

List之Stack源码分析

摘要: 源码版本为JDK1.7.0_75。 该类继承自Vector,说明该类是可克隆的、可序列化的,且是同步的。 public class Stack<E> extends Vector<E> 构造函数 public Stack() { } 入栈 /** * 将一个元素放入栈顶,通过vector类的addE 阅读全文

posted @ 2016-02-22 16:56 olive_lv 阅读(137) 评论(0) 推荐(0)

导航