IncredibleThings

导航

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 28 下一页

2019年10月14日 #

LeetCode - Convert Sorted Array to Binary Search Tree

摘要: 题目需要构建height-balanced BST, 应该能想到找到中间的点,然后构造,构造的时候用DFS 阅读全文

posted @ 2019-10-14 10:41 IncredibleThings 阅读(87) 评论(0) 推荐(0) 编辑

2019年10月8日 #

LeetCode - Sqrt(x)

摘要: Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an in 阅读全文

posted @ 2019-10-08 13:20 IncredibleThings 阅读(110) 评论(0) 推荐(0) 编辑

2018年12月3日 #

LeetCode - Min Remaining Chess Pieces

摘要: DFS count connected components: 阅读全文

posted @ 2018-12-03 11:18 IncredibleThings 阅读(158) 评论(0) 推荐(0) 编辑

LeetCode - Backspace String Compare

摘要: 注意,这道题都是需要 time O(n) 和 space O(1)的,所以需要用 two pointer来做,注意最后结束条件: 阅读全文

posted @ 2018-12-03 06:45 IncredibleThings 阅读(131) 评论(0) 推荐(0) 编辑

LeetCode - Implement Magic Dictionary

摘要: 只需检测和要搜索单词长度一样的单词即可,所以我们用的数据结构就是根据单词的长度来分,把长度相同相同的单词放到一起,这样就可以减少搜索量。那么对于和要搜索单词进行比较的单词,由于已经保证了长度相等,我们直接进行逐个字符比较即可,用cnt表示不同字符的个数,初始化为0。如果当前遍历到的字符相等,则con 阅读全文

posted @ 2018-12-03 05:47 IncredibleThings 阅读(145) 评论(0) 推荐(0) 编辑

LeetCode - Robot Room Cleaner

摘要: 参考了一个很清晰的DFS的code: 阅读全文

posted @ 2018-12-03 01:29 IncredibleThings 阅读(153) 评论(0) 推荐(0) 编辑

2018年12月2日 #

Google - Largest Sum Submatrix

摘要: Given an NxN matrix of positive and negative integers, write code to find the submatrix with the largest possible sum. // "static void main" must be defined in a public class. public class Main { ... 阅读全文

posted @ 2018-12-02 11:34 IncredibleThings 阅读(192) 评论(0) 推荐(0) 编辑

LeetCode - Maximum Subarray

摘要: algorithm that operates on arrays: it starts at the left end (element A[1]) and scans through to the right end (element A[n]), keeping track of the ma 阅读全文

posted @ 2018-12-02 10:53 IncredibleThings 阅读(104) 评论(0) 推荐(0) 编辑

LeetCode - Unique Paths II

摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文

posted @ 2018-12-02 02:15 IncredibleThings 阅读(159) 评论(0) 推荐(0) 编辑

LeetCode - Unique Paths

摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文

posted @ 2018-12-02 00:34 IncredibleThings 阅读(128) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 28 下一页