随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 ··· 19 下一页
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2017-05-30 01:07 amazingzoe 阅读(856) 评论(0) 推荐(1)
摘要:We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2017-05-29 14:32 amazingzoe 阅读(144) 评论(0) 推荐(0)
摘要:Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a 阅读全文
posted @ 2017-05-22 14:43 amazingzoe 阅读(113) 评论(0) 推荐(0)
摘要:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2017-05-09 15:07 amazingzoe 阅读(251) 评论(0) 推荐(0)
摘要:Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the defin 阅读全文
posted @ 2017-05-05 14:11 amazingzoe 阅读(197) 评论(0) 推荐(0)
摘要:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2017-05-04 14:05 amazingzoe 阅读(133) 评论(0) 推荐(0)
摘要:Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2017-05-01 13:12 amazingzoe 阅读(200) 评论(0) 推荐(0)
摘要:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi 阅读全文
posted @ 2017-04-29 14:49 amazingzoe 阅读(189) 评论(0) 推荐(0)
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-04-28 13:44 amazingzoe 阅读(142) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba” and k = 2, T is 阅读全文
posted @ 2017-04-26 13:02 amazingzoe 阅读(148) 评论(0) 推荐(0)
摘要:Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the sam 阅读全文
posted @ 2017-04-24 13:12 amazingzoe 阅读(126) 评论(0) 推荐(0)
摘要:There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. Yo 阅读全文
posted @ 2017-04-23 13:50 amazingzoe 阅读(250) 评论(0) 推荐(0)
摘要:Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make pro 阅读全文
posted @ 2017-04-21 14:13 amazingzoe 阅读(119) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1. Example 1: Example 2: Note: The length of the giv 阅读全文
posted @ 2017-04-19 13:58 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要:Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Note:The sum of 阅读全文
posted @ 2017-04-18 14:18 amazingzoe 阅读(138) 评论(0) 推荐(0)
摘要:Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given points. Example 1: Given points = [[1,1],[-1,1]], 阅读全文
posted @ 2017-04-17 14:00 amazingzoe 阅读(213) 评论(0) 推荐(0)
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 阅读全文
posted @ 2017-04-10 13:16 amazingzoe 阅读(132) 评论(0) 推荐(0)
摘要:Given a picture consisting of black and white pixels, find the number of black lonely pixels. The picture is represented by a 2D char array consisting 阅读全文
posted @ 2017-04-03 07:41 amazingzoe 阅读(173) 评论(0) 推荐(0)
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2017-04-03 05:34 amazingzoe 阅读(156) 评论(0) 推荐(0)
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You a 阅读全文
posted @ 2017-04-03 05:11 amazingzoe 阅读(130) 评论(0) 推荐(0)

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