BlooooooG


  • Home

  • Categories

  • Archives

  • Tags

  • Search

LeetCode Problem 97-Interleaving String

Posted on 2019-05-13 | In LeetCode | Visitors

交错字符串。给定三个字符串 s1, s2, s3, 验证 s3 是否是由 s1 和 s2 交错组成的。

示例 1:

1
2
输入: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"
输出: true

示例 2:

1
2
输入: s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"
输出: false
Read more »

LeetCode Problem 96-Unique Binary Search Trees

Posted on 2019-05-08 | In LeetCode | Visitors

不同的二叉搜索树。给定一个整数 n,求以 1 … n 为节点组成的二叉搜索树有多少种?

示例:

1
2
3
4
5
6
7
8
9
10
输入: 3
输出: 5
解释:
给定 n = 3, 一共有 5 种不同结构的二叉搜索树:

   1         3     3      2      1
    \       /     /      / \      \
     3     2     1      1   3      2
    /     /       \                 \
   2     1         2                 3
Read more »

LeetCode Problem 95-Unique Binary Search Trees II

Posted on 2019-05-07 | In LeetCode | Visitors

不同的二叉搜索树 II。给定一个整数 n,生成所有由 1 … n 为节点所组成的二叉搜索树。

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
输入: 3
输出:
[
  [1,null,3,2],
  [3,2,null,1],
  [3,1,null,null,2],
  [2,1,3],
  [1,null,2,null,3]
]
解释:
以上的输出对应以下 5 种不同结构的二叉搜索树:

   1         3     3      2      1
    \       /     /      / \      \
     3     2     1      1   3      2
    /     /       \                 \
   2     1         2                 3
Read more »

LeetCode Problem 94-Binary Tree Inorder Traversal

Posted on 2019-05-07 | In LeetCode | Visitors

二叉树的中序遍历。给定一个二叉树,返回它的中序 遍历。

示例:

1
2
3
4
5
6
7
8
输入: [1,null,2,3]
   1
    \
     2
    /
   3

输出: [1,3,2]

进阶: 递归算法很简单,你可以通过迭代算法完成吗?

Read more »

LeetCode Problem 93-Restore IP Addresses

Posted on 2019-05-07 | In LeetCode | Visitors

复原IP地址。给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。

示例:

1
2
输入: "25525511135"
输出: ["255.255.11.135", "255.255.111.35"]
Read more »

LeetCode Problem 92-Reverse Linked List II

Posted on 2019-05-07 | In LeetCode | Visitors

反转链表 II。反转从位置 m 到 n 的链表。请使用一趟扫描完成反转。

说明: 1 ≤ m ≤ n ≤ 链表长度。

示例:

1
2
输入: 1->2->3->4->5->NULL, m = 2, n = 4
输出: 1->4->3->2->5->NULL
Read more »

Latent Factor Hashing

Posted on 2019-04-26 | In Research Note | Visitors

本文就论文 Supervised Hashing with Latent Factor Models 和论文 Discrete Latent Factor Model for Cross-Modal Hashing 对 Latent Factor Hashing (LFH) 做简单总结。

Read more »

LeetCode Problem 91-Decode Ways

Posted on 2019-04-11 | In LeetCode | Visitors

解码方法。一条包含字母 A-Z 的消息通过以下方式进行了编码:

1
2
3
4
'A' -> 1
'B' -> 2
...
'Z' -> 26

给定一个只包含数字的非空字符串,请计算解码方法的总数。

Read more »

LeetCode Problem 90-Subsets II

Posted on 2019-04-11 | In LeetCode | Visitors

子集 II。给定一个可能包含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。

说明:解集不能包含重复的子集。

Read more »

LeetCode Problem 89-Gray Code

Posted on 2019-04-10 | In LeetCode | Visitors

格雷编码。格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。

给定一个代表编码总位数的非负整数 n,打印其格雷编码序列。格雷编码序列必须以 0 开头。

Read more »
1 2 3 4 … 14
Wendell Gu

Wendell Gu

138 posts
4 categories
68 tags
GitHub
© 2021 Wendell Gu
Powered by Jekyll
Theme - NexT.Mist
Storage Service - UPYUN