Problem Find the number Weak Connected Component in the directed graph. Each node in the graph contains a labe…
标签:LeetCode
254. Factor Combinations
Problem Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a functi…
[LintCode] Number of Islands
Problem Given a boolean 2D matrix, find the number of islands. Notice 0 is represented as the sea, 1 is repres…
Swift 验证回文字符串 - LeetCode
LeetCode.jpg 题目:验证回文字符串 描述:给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 案例1: 输入: "A man, …
[LintCode][Sort][Heap] Kth Largest Element
Problem More Discussions Find K-th largest element in an array. Example In array [9,3,2,4,8], the 3rd largest …
LeetCode算法练习——深度优先搜索 DFS(2)
更多干货就在我的个人博客 BlackBlog.tech 欢迎关注! 也可以关注我的csdn博客:黑哥的博客 谢谢大家! 我们继续LeetCode之旅. 做了一段时间的LeetCode,感觉还是不错的。算法很基础,没有特别…
LeetCode 374. Guess Number Higher or Lower
Guess Number Higher or Lower unlocked question, 不贴截图了 EST 7/13/2016, 1:14AM. Beijing time 7/13/2016, 1:14PM. 截…
[LintCode][2Sum] Triangle Count
Problem More Discussions Given an array of integers, how many three numbers can be found in the array, so that…
Swift 从排序数组中删除重复项 - LeetCode
从排序数组中删除重复项 给定一个有序数组,你需要原地删除其中的重复内容,使每个元素只出现一次,并返回新的长度。 不要另外定义一个数组,您必须通过用 O(1) 额外内存原地修改输入的数组来做到这一点。 示例: 给定数组: …
125. 验证回文串
一、题目原型: 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。 说明:本题中,我们将空字符串定义为有效的回文串。 二、示例剖析: 示例 1: 输入: "A man, a plan, a …
Swift 实现strStr() - LeetCode
LeetCode.jpg 题目:实现strStr() 描述:给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存…
Swift 二叉树的最大深度- LeetCode
LeetCode 题目: 二叉树的最大深度 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉树[3,9,20,null,…