摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2018-11-29 18:21 fatttcat 阅读(173) 评论(0) 推荐(0)
摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
posted @ 2018-11-29 17:52 fatttcat 阅读(106) 评论(0) 推荐(0)
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Input: [3,0,1] Output 阅读全文
posted @ 2018-11-29 17:01 fatttcat 阅读(210) 评论(0) 推荐(0)
摘要: Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s 阅读全文
posted @ 2018-11-29 16:56 fatttcat 阅读(97) 评论(0) 推荐(0)
摘要: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: 用dp。二重循环,如果dp[i][j]=1,检查一下 阅读全文
posted @ 2018-11-29 16:37 fatttcat 阅读(106) 评论(0) 推荐(0)
摘要: Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
posted @ 2018-11-29 13:02 fatttcat 阅读(127) 评论(0) 推荐(0)
摘要: Given two 1d vectors, implement an iterator to return their elements alternately. Example: Follow up: What if you are given k 1d vectors? How well can 阅读全文
posted @ 2018-11-29 12:09 fatttcat 阅读(119) 评论(0) 推荐(0)
摘要: A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return 阅读全文
posted @ 2018-11-29 05:29 fatttcat 阅读(130) 评论(0) 推荐(0)