Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as: h d e l l r ...
分类:
其他好文 时间:
2020-01-22 14:29:27
阅读次数:
98
Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, ...
分类:
其他好文 时间:
2020-01-22 11:06:54
阅读次数:
64
Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and ...
分类:
其他好文 时间:
2020-01-22 10:56:58
阅读次数:
75
斐波那契数列。题意很简单,求出斐波那契数列里面第N个数。这个题有好几个思路,分别是迭代,递归和动态规划。虽然是个基础题但是涉及到的思路还是比较全面的,故而都列出来。例子, Example 1: Input: 2Output: 1Explanation: F(2) = F(1) + F(0) = 1 ...
分类:
其他好文 时间:
2020-01-22 10:40:54
阅读次数:
60
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 O ...
分类:
其他好文 时间:
2020-01-21 18:22:25
阅读次数:
90
Python 练习实例28 题目:有5个人坐在一起,问第五个人家电维修多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第3个人大2岁。问第三个人,又说比第2人大两岁。问第2个人,说比第一个人大两岁。最后问第一个人,他说是10岁。请问第五个人多大? 程序分析:利用递归的方法,递归分为回推和递推两个 ...
分类:
编程语言 时间:
2020-01-21 17:53:19
阅读次数:
63
除本身之外的数组之积。题意是给一个数组,请输出一个(应该是等长的)数组,res[i]位上存的是input数组除了i位其他所有数字的乘积。例子, Example: Input: [1,2,3,4] Output: [24,12,8,6] 注意这个题不能用除法,如果用除法会很简单。思路是对于在i位上的数 ...
分类:
其他好文 时间:
2020-01-21 14:45:44
阅读次数:
84
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the ...
分类:
其他好文 时间:
2020-01-21 13:21:50
阅读次数:
88
1)安装git,略 $ git config --global user.name "Your Name" $ git config --global user.email "email@example.com" 3)选择合适地方,创建空目录 $ mkdir test //创建空目录,目录名字为te ...
分类:
其他好文 时间:
2020-01-20 22:29:12
阅读次数:
101
leetcode 976 给定由一些正数(代表长度)组成的数组 A,返回由其中三个长度组成的、面积不为零的三角形的最大周长。 如果不能形成任何面积不为零的三角形,返回 0。 1 impl Solution { 2 pub fn largest_perimeter(a: Vec<i32>) -> i3 ...
分类:
其他好文 时间:
2020-01-19 19:36:11
阅读次数:
123