- 博客(7)
- 收藏
- 关注
原创 leetcode由易入难——【6】Count and Say
The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read off as "
2015-06-29 20:10:01 470
转载 leetcode由易入难——【5】Compare Version Numbers
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0. You may assume that the version strings are non-empty and
2015-06-26 10:33:05 244
原创 leetcode由易入难——【4】Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26Given an encoded message containing digits, determine the total num
2015-06-26 09:43:16 689
原创 leetcode由易入难——【3】Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 分析 设f(n)表示爬n阶楼梯的不同方法数
2015-06-26 09:36:24 315
原创 DFS(深度优先搜索)解析
1.1 Balanced Binary Tree(平衡二叉树) 平衡二叉树又被称为AVL树(有别于AVL算法),且具有以下性质:它是一 棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树。常用算法有红黑树、AVL、Treap、伸展树等。在平衡二叉搜索树中,我们可以看到,其高度一般都良好地维持在O(log2n),大大降低了操作的时间复杂度。
2015-06-25 16:07:42 559
原创 leetcode由易入难——【2】Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never d
2015-06-25 15:28:33 378
原创 leetcode由易入难——【1】Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100".
2015-06-25 14:24:49 346
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人