LeetCode
文章平均质量分 57
Cecilia_whf
这个作者很懒,什么都没留下…
展开
-
LeetCode606:Construct String from Binary Tree
题干大致: 根据已给的二叉树,按照先序遍历的顺序生成字符串,利用()分开各个子树。 Example1: Input: Binary tree: [1,2,3,4] 1 / \ 2 3 / 4 Output: “1(2(4))(3)” Example2: Input: Binary tree: [1,2,3,null,4]原创 2017-06-20 21:24:24 · 389 阅读 · 1 评论 -
LeetCode 7 : Reverse Integer
LeetCode 7 : Reverse Integer题目大意反向输出整型数DescriptionReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.NoteThe input is assumed to be a 3原创 2017-08-29 20:15:53 · 247 阅读 · 0 评论 -
LeetCode 135 : Candy
[LeetCode 135 : Candy](LeetCode 135 : Candy)题目大意Description There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the fo原创 2017-09-14 22:13:50 · 323 阅读 · 0 评论 -
LeetCode 120 : Triangle
LeetCode 120 : Triangle题目大意给定一个数字三角形,求出从最上层运动到最下层的最短路径。DescriptionGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.Example原创 2017-08-28 15:45:48 · 253 阅读 · 0 评论 -
LeetCode 122 : Best Time to Buy and Sell Stock II
LeetCode 122 : Best Time to Buy and Sell Stock II题目大意已知股票在一段时间内的价格数组,并可以在任意时间买进或者卖出,求可以获得的最大利润。DescriptionSay you have an array for which the ith element is the price of a given stock on day i.Desig原创 2017-08-23 19:37:58 · 349 阅读 · 0 评论 -
LeetCode 476 : Number Complement
LeetCode 476 : Number Complement题目大意输入一个正数,求其二进制的补数的十进制形式。DescriptionGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.N原创 2017-07-21 21:24:34 · 385 阅读 · 0 评论 -
LeetCode 561 : ArrayPartition I
LeetCode 561 : ArrayPartition I题目大意将一个长度为2n的数组分成n对,获取每对中的最小值,使最小值的和最大。 - DescriptionGiven an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2),原创 2017-07-14 16:58:35 · 359 阅读 · 0 评论 -
LeetCode 605 : Can Place Flowers
LeetCode 605 : Can Place Flowers题目大意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 would compete原创 2017-07-07 22:43:35 · 499 阅读 · 0 评论 -
LeetCode628 : Maximum Product of Three Numbers
LeetCode628 : Maximum Product of Three Numbers题目大意从所给数组中取三个数求其乘积并比较,返回最大的乘积 - Example1Input: [1,2,3]Output: 6Example2Input: [1,2,3,4]Output: 24Note 1. The length of the given array will be in原创 2017-07-06 23:27:45 · 390 阅读 · 0 评论 -
LeetCode 461: Hamming Distance
LeetCode 461: Hamming Distance题目大意求两个整型数x,y的汉明距离。DescriptionThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y原创 2017-07-12 21:07:01 · 281 阅读 · 0 评论 -
LeetCode 617. Merge Two Binary Trees
LeetCode 617. Merge Two Binary Trees题目大意:根据已给的二叉树,将相对应位置的值相加,获得合并后的二叉树。(空值相当于0)-Example:Input: Tree 1 Tree 2 1 2原创 2017-06-22 20:32:51 · 697 阅读 · 0 评论 -
LeetCode 6 :Zigzag Conversion
LeetCode 6 :Zigzag Conversion题目大意给定一个字符串,将其按照Z字形排列成给定行,逐行输出排列后的字符串。The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern原创 2017-09-07 13:13:27 · 378 阅读 · 0 评论