wo elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its struct…
分类:LeetCode
LeetCode115 Distinct Subsequences 动态规划
发现LeetCode上的题,一旦第一时间没有头绪,那么它很有可能是一道动态规则题。 附上自己AC的代码:https://github.com/JiangJiafu/LeetCode/blob/master/src/Sol…
[LintCode][System Design] Consistent Hashing II
Problem More in LeetCode Discussion 在 Consistent Hashing I 中我们介绍了一个比较简单的一致性哈希算法,这个简单的版本有两个缺陷: 增加一台机器之后,数据全部从其中…
415. Add Strings
/* 415. Add Strings Total Accepted: 4917 Total Submissions: 11391 Difficulty: Easy Contributors: Admin Given t…
Day 21.Unique Morse Code Words(804)
问题描述 International Morse Code defines a standard encoding where each letter is mapped to a series of dots and …
59. Spiral Matrix II
59. Spiral Matrix II 题目 Given an integer n, generate a square matrix filled with elements from 1 to n2 in spir…
[LeetCode] Contains Duplicate 包含重复值,Contains Duplicate II 包含重复值之二
Given an array of integers, find if the array contains any duplicates. Your function should return true…
[LeetCode] Next Closest Time 下一个最近时间点
Given a time represented in the format “HH:MM”, form the next closest time by reusing the c…
LeetCode 203 Remove Linked List Elements
题目描述 Remove all elements from a linked list of integers that have value val. Example Given: 1 –> 2 –> 6 …
LeetCode 74. Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following prope…
[LintCode][System Design] Tiny Url II
Problem As a follow up for Tiny URL, we are going to support custom tiny url, so that user can create their ow…
28. 实现strStr()(Swift版)
一、题目 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。…