随笔分类 -  leetcode

https://leetcode.com/problemset/all/
摘要:There is an m by n grid with a ball. Given the start coordinate (i,j) of the ball, you can move the ball to adjacent cell or cross the grid boundary i 阅读全文
posted @ 2018-10-09 10:31 bernieloveslife 阅读(127) 评论(0) 推荐(0)
摘要:Given a n ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2018-10-09 10:31 bernieloveslife 阅读(90) 评论(0) 推荐(0)
摘要:Given an array, rotate the array to the right by k steps, where k is non negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] 阅读全文
posted @ 2018-10-09 10:31 bernieloveslife 阅读(103) 评论(0) 推荐(0)
摘要:Given n pairs of parentheses, write a function to generate all combinations of well formed parentheses. For example, given n = 3, a solution set is: [ 阅读全文
posted @ 2018-10-08 13:00 bernieloveslife 阅读(172) 评论(0) 推荐(0)
摘要:A robot on an infinite grid starts at point (0, 0) and faces north. The robot can receive one of three possible types of commands: 2: turn left 90 deg 阅读全文
posted @ 2018-10-08 13:00 bernieloveslife 阅读(315) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [ 2, 0, 3, 5, 2, 1] sumRan 阅读全文
posted @ 2018-10-08 13:00 bernieloveslife 阅读(146) 评论(0) 推荐(0)
摘要:A message containing letters from A Z is being encoded to numbers using the following mapping: 'A' 1 'B' 2 ... 'Z' 26 Given a non empty string contain 阅读全文
posted @ 2018-10-08 13:00 bernieloveslife 阅读(270) 评论(0) 推荐(0)
摘要:Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat", 阅读全文
posted @ 2018-10-08 13:00 bernieloveslife 阅读(144) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2018-10-07 12:47 bernieloveslife 阅读(447) 评论(0) 推荐(0)
摘要:Your are given an array of integers prices, for which the i th element is the price of a given stock on day i; and a non negative integer fee represen 阅读全文
posted @ 2018-10-07 12:47 bernieloveslife 阅读(125) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-10-07 12:46 bernieloveslife 阅读(106) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2018-10-07 12:46 bernieloveslife 阅读(125) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2018-10-07 12:46 bernieloveslife 阅读(171) 评论(0) 推荐(0)
摘要:Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and ' '. '.' Matches any single character. ' ' 阅读全文
posted @ 2018-10-06 13:22 bernieloveslife 阅读(145) 评论(0) 推荐(0)
摘要:You have a list of points in the plane. Return the area of the largest triangle that can be formed by any 3 of the points. Example: Input: points = [[ 阅读全文
posted @ 2018-10-06 13:22 bernieloveslife 阅读(100) 评论(0) 推荐(0)
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c 阅读全文
posted @ 2018-10-06 13:22 bernieloveslife 阅读(98) 评论(0) 推荐(0)
摘要:A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom left corner, and (x2, y2) are the coordinates 阅读全文
posted @ 2018-10-06 13:22 bernieloveslife 阅读(117) 评论(0) 推荐(0)
摘要:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up: Can yo 阅读全文
posted @ 2018-10-06 13:22 bernieloveslife 阅读(100) 评论(0) 推荐(0)
摘要:In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X = 2 such that it is possible to split the enti 阅读全文
posted @ 2018-10-05 11:11 bernieloveslife 阅读(493) 评论(0) 推荐(0)
摘要:Given a non negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Input: 5 Output: True E 阅读全文
posted @ 2018-10-05 11:11 bernieloveslife 阅读(81) 评论(0) 推荐(0)