2018年9月20日

844. Backspace String Compare

摘要: Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = "ab#c", T = "ad#c" Output: true Explanation: Both... 阅读全文

posted @ 2018-09-20 18:31 猪猪🐷 阅读(129) 评论(0) 推荐(0)

734. Sentence Similarity

摘要: Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are similar. For example, "great acting skills" and "f... 阅读全文

posted @ 2018-09-20 18:30 猪猪🐷 阅读(164) 评论(0) 推荐(0)

729. My Calendar I

摘要: Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking. Your class will have the method, book(int start, int end). Formally, t... 阅读全文

posted @ 2018-09-20 18:27 猪猪🐷 阅读(151) 评论(0) 推荐(0)

737. Sentence Similarity II

摘要: 737. Sentence Similarity II Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are similar. For example... 阅读全文

posted @ 2018-09-20 18:26 猪猪🐷 阅读(161) 评论(0) 推荐(0)

760. Find Anagram Mappings

摘要: 760. Find Anagram Mappings Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizing the order of the elements in A. We want to find an index mapping P, ... 阅读全文

posted @ 2018-09-20 18:25 猪猪🐷 阅读(105) 评论(0) 推荐(0)

130. Surrounded Regions

摘要: Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. Example: X X X X X O O X ... 阅读全文

posted @ 2018-09-20 18:23 猪猪🐷 阅读(101) 评论(0) 推荐(0)

766. Toeplitz Matrix

摘要: 1. 这个带返回值的recursion, 2. 如果out of bound, return true, 说明走到头了 阅读全文

posted @ 2018-09-20 18:22 猪猪🐷 阅读(82) 评论(0) 推荐(0)

62. 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 point in time. The robot is trying to reach the b... 阅读全文

posted @ 2018-09-20 18:21 猪猪🐷 阅读(85) 评论(0) 推荐(0)

7. Reverse Integer

摘要: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 class Solution { public i... 阅读全文

posted @ 2018-09-20 18:20 猪猪🐷 阅读(63) 评论(0) 推荐(0)

84. Largest Rectangle in Histogram

摘要: 84. Largest Rectangle in Histogram https://www.youtube.com/watch?v=KkJrGxuQtYo&t=129s https://leetcode.com/problems/largest-rectangle-in-histogram/solution/ https://www.cnblogs.com/boring09/p/42... 阅读全文

posted @ 2018-09-20 18:18 猪猪🐷 阅读(133) 评论(0) 推荐(0)

64. Minimum Path Sum

摘要: https://leetcode.com/problems/minimum-path-sum/solution/ Approach 3: Dynamic Programming 1D Approach 4: Dynamic Programming (Without Extra Space) 阅读全文

posted @ 2018-09-20 18:17 猪猪🐷 阅读(86) 评论(0) 推荐(0)

50. Pow(x, n)

摘要: Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: 9.26100 Example 3: Input: 2.00000, -2 Output:... 阅读全文

posted @ 2018-09-20 18:16 猪猪🐷 阅读(96) 评论(0) 推荐(0)

329. Longest Increasing Path in a Matrix

摘要: Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside o... 阅读全文

posted @ 2018-09-20 18:15 猪猪🐷 阅读(101) 评论(0) 推荐(0)

394. Decode String

摘要: 394. Decode String Two solutions: solution 1 : Recursion , solution 2 : Iterative with stack to imitate the call stack used in recursion http://www.cnblogs.com/grandyang/p/5849037.html publ... 阅读全文

posted @ 2018-09-20 18:14 猪猪🐷 阅读(88) 评论(0) 推荐(0)

343. Integer Break

摘要: 343. Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. Example 1: ... 阅读全文

posted @ 2018-09-20 18:11 猪猪🐷 阅读(68) 评论(0) 推荐(0)

198. House Robber

摘要: 198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is... 阅读全文

posted @ 2018-09-20 18:09 猪猪🐷 阅读(79) 评论(0) 推荐(0)

485. Max Consecutive Ones

摘要: 485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last thre... 阅读全文

posted @ 2018-09-20 18:09 猪猪🐷 阅读(78) 评论(0) 推荐(0)

646. Maximum Length of Pair Chain

摘要: 646. Maximum Length of Pair Chain You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair (a,... 阅读全文

posted @ 2018-09-20 18:08 猪猪🐷 阅读(98) 评论(0) 推荐(0)

55. Jump Game

摘要: 55. Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. D... 阅读全文

posted @ 2018-09-20 18:07 猪猪🐷 阅读(238) 评论(0) 推荐(0)

152. Maximum Product Subarray

摘要: 152. Maximum Product Subarray Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] ... 阅读全文

posted @ 2018-09-20 18:06 猪猪🐷 阅读(93) 评论(0) 推荐(0)

导航