摘要:
Tags:Tree 94. Binary Tree Inorder Traversal:https://leetcode.com/problems/binary-tree-inorder-traversal/ 中序遍历: (解法1:递归; 利用addAll 或者 helper(root,rst); 阅读全文
摘要:
LeetCode: Tags-[Linked List] 2. Add Two Numbers: https://leetcode.com/problems/add-two-numbers/ 两个单链表代表倒序的数字, 求和: (Input: (2 -> 4 -> 3) + (5 -> 6 -> 4 阅读全文
摘要:
Tags: Hash Table 3. Longest Substring Without Repeating Characters:https://leetcode.com/problems/longest-substring-without-repeating-characters/ 没有重复字 阅读全文
摘要:
Tags: Array Difficulty: Medium 11. Container With Most Water: https://leetcode.com/problems/container-with-most-water/ n条纵线,找出两条线使得容器最大:(题意:假设ai,aj Cm 阅读全文
摘要:
1.HashMap<K,V>的常见method; containsKey(Object key)--boolean containsValue(Object value)--boolean put(K key, V value) --插入键值对; remove(Object key) replace 阅读全文
摘要:
Tags: Array Difficulty:Easy 1. Two Sum:https://leetcode.com/problems/two-sum/ 两数和,返回下标数组:(利用HashMap<Key,Value>遍历,其中用到containKey,get(key)--获取value; put 阅读全文
摘要:
示例代码: Code Style: for后有空格 if后有空格 运算符前后有空格(+-*/,==,!=,) 逗号分号后有空格 if for 的大括号不可省略(- -) Bug Free: else/if后没有加括号导致只执行了第一条语句; for()里的参数没有先定义(有的时候需要在外面定义); 阅读全文
摘要:
Difficulty--Naive 463.Sort Integer 整数排序:http://www.lintcode.com/en/problem/sort-integers/# 冒泡排序:(两两比较取出最大的放最后) (外循环-趟数0,n-1;内循环-有序区的比较次数n-i-1趟;判断a[j] 阅读全文