Leetcode
syf_2016
只事耕耘不问收获
展开
-
357. Count Numbers with Unique Digits统计各位不同的数字个数
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excludin原创 2016-07-20 13:15:18 · 568 阅读 · 0 评论 -
572. Subtree of Another Tree 子树的判定
给定两棵非空二叉树s和t,判定t是否为s的一棵子树。原创 2017-08-30 10:31:39 · 207 阅读 · 0 评论 -
606. Construct String from Binary Tree 二叉树的字符串描述
根据给定的二叉树返回根据其建立的字符串,建立原则按照先序序列顺序,有子节点的用括号括起来,叶子节点的括号省略。特别的,若左孩子不存在而有孩子存在,则左孩子的括号不可省略。原创 2017-08-30 10:30:21 · 248 阅读 · 0 评论 -
617. Merge Two Binary Trees 二叉树合并
将给定的两个二叉树合并,对应节点都存在的话将值相加作为合并后的节点值。原创 2017-08-30 10:29:00 · 232 阅读 · 0 评论 -
624. Maximum Distance in Arrays 数组最大距离
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 calculate the distance. We define the distance between原创 2017-08-30 10:27:08 · 423 阅读 · 0 评论 -
637. Average of Levels in Binary Tree 二叉树每层平均值
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. 给定一非空二叉树,返回其每层的平均值所构成的数组。原创 2017-08-30 10:21:52 · 245 阅读 · 0 评论 -
647. Palindromic Substrings 回文子串
Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even they consist原创 2017-08-30 10:19:14 · 270 阅读 · 0 评论 -
30. Substring with Concatenation of All Words
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) ins that is a concatenation of each word in words exactly once and转载 2016-07-20 13:25:32 · 173 阅读 · 0 评论 -
374. Guess Number Higher or Lower猜数大小
We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number is higher or原创 2016-07-20 13:23:05 · 540 阅读 · 0 评论 -
367. Valid Perfect Square有效的平方数
Given a positive integer num, write a function which returns True ifnum is a perfect square else False.Note:Do not use any built-in library function such assqrt.Example 1:Input: 16Returns:原创 2016-07-20 13:21:42 · 389 阅读 · 0 评论 -
300. Longest Increasing Subsequence最长递增子序列
Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], theref原创 2016-07-20 13:19:58 · 758 阅读 · 0 评论 -
257. Binary Tree Paths 二叉树的路径
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]给定二叉树,返回其所有根到叶的路径。原创 2016-07-20 13:18:34 · 250 阅读 · 0 评论 -
567. Permutation in String 字符串置换
给定两个字符串s1和s2,编写函数判定s2是否是s1的置换字符串。原创 2017-08-30 10:35:14 · 271 阅读 · 0 评论