摘要: Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Example 1: Note: 解法:hash 阅读全文
posted @ 2018-12-02 09:56 fatttcat 阅读(119) 评论(0) 推荐(0)
摘要: Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: Input: A = [ [ 阅读全文
posted @ 2018-12-02 04:53 fatttcat 阅读(177) 评论(0) 推荐(0)
摘要: Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find 阅读全文
posted @ 2018-12-01 17:04 fatttcat 阅读(114) 评论(0) 推荐(0)
摘要: Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For 阅读全文
posted @ 2018-12-01 14:54 fatttcat 阅读(109) 评论(0) 推荐(0)
摘要: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2018-12-01 14:52 fatttcat 阅读(114) 评论(0) 推荐(0)
摘要: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2018-12-01 07:31 fatttcat 阅读(129) 评论(0) 推荐(0)
摘要: 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)