随笔分类 -  Leetcode

1 2 3 4 5 ··· 19 下一页
摘要:Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list t 阅读全文
posted @ 2018-06-05 08:48 amazingzoe 阅读(128) 评论(0) 推荐(0)
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2018-05-30 13:23 amazingzoe 阅读(89) 评论(0) 推荐(0)
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2018-05-27 06:03 amazingzoe 阅读(118) 评论(0) 推荐(0)
摘要:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-05-24 12:17 amazingzoe 阅读(85) 评论(0) 推荐(0)
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2018-05-23 11:35 amazingzoe 阅读(171) 评论(0) 推荐(0)
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the 阅读全文
posted @ 2018-05-21 08:05 amazingzoe 阅读(92) 评论(0) 推荐(0)
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g 阅读全文
posted @ 2018-05-21 07:49 amazingzoe 阅读(136) 评论(0) 推荐(0)
摘要:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2018-05-20 05:34 amazingzoe 阅读(139) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2018-05-20 04:40 amazingzoe 阅读(91) 评论(0) 推荐(0)
摘要:Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t 阅读全文
posted @ 2018-05-18 09:17 amazingzoe 阅读(135) 评论(0) 推荐(0)
摘要:Solution: 1. From left to right 阅读全文
posted @ 2018-05-14 07:10 amazingzoe 阅读(83) 评论(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-05-14 05:55 amazingzoe 阅读(100) 评论(0) 推荐(0)
摘要:A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m 阅读全文
posted @ 2018-05-14 05:12 amazingzoe 阅读(160) 评论(0) 推荐(0)
摘要:Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element 阅读全文
posted @ 2017-07-14 12:16 amazingzoe 阅读(152) 评论(0) 推荐(0)
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 Outp 阅读全文
posted @ 2017-07-10 12:14 amazingzoe 阅读(333) 评论(0) 推荐(0)
摘要:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are n 阅读全文
posted @ 2017-06-22 11:31 amazingzoe 阅读(117) 评论(0) 推荐(0)
摘要:Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and cal 阅读全文
posted @ 2017-06-20 12:33 amazingzoe 阅读(311) 评论(0) 推荐(0)
摘要:Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] -> 2 / 3 / 4. However, you can add any 阅读全文
posted @ 2017-06-14 14:29 amazingzoe 阅读(170) 评论(0) 推荐(0)
摘要:Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2017-06-14 11:12 amazingzoe 阅读(177) 评论(0) 推荐(0)
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2017-06-09 12:43 amazingzoe 阅读(157) 评论(0) 推荐(0)

1 2 3 4 5 ··· 19 下一页