142. O(1)时间检测2的幂次 用 O(1) 时间检测整数 n 是否是 2 的幂次。 样例 Example 1: Input: 4 Output: true Example 2: Input: 5 Output: false 挑战 O(1) time 第一种方法:&的方法 class Solut ...
分类:
其他好文 时间:
2020-01-15 12:02:20
阅读次数:
46
题源 Input 7 7 8 1 3 2 5 2 4 6 5 6 1 8 1 2 9 5 4 3 3 4 10 3 7 4 Output 1 24 一看就知道是个什么套路 记录每个点的siz , dis。在父子节点间考虑转移。 然后搞了个代码,过了个极水的样例 1 #include<stdio.h> ...
分类:
其他好文 时间:
2020-01-14 20:24:42
阅读次数:
74
寻找最小最左叶子节点的值。题意是给一个二叉树,请return最底层,最靠左边节点的值。例子 Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7 Note: You ma ...
分类:
其他好文 时间:
2020-01-14 09:45:41
阅读次数:
51
相对排名。题意很简单,给一个数组表示一堆运动员的名次,请输出他们的相对排名,前三名需要有一些改动。例子如下, Input: [5, 4, 3, 2, 1] Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"] Explana ...
分类:
其他好文 时间:
2020-01-14 09:30:02
阅读次数:
71
Java的IO流概述:1.I/O是Input/Output的缩写,I/O技术是非常实用的技术,用于处理设备之间的数据传输。如读/写文件,网络通讯等。2.Java程序中,对于数据的输入/输出操作以“流(stream)” 的方式进行。3.java.io包下提供了各种“流”类和接口,用以获取不同种类的数据 ...
分类:
编程语言 时间:
2020-01-13 21:56:35
阅读次数:
105
C. Flag time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Innokenty works at a flea market ...
分类:
其他好文 时间:
2020-01-12 15:08:52
阅读次数:
71
二叉树路径。题意是给一个二叉树,请输出从根节点遍历到每个最小的叶子节点的路径。例子 Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] Explanation: All root-to-leaf paths are: 1->2->5, ...
分类:
其他好文 时间:
2020-01-12 13:25:09
阅读次数:
71
F. Mars rover time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output Natasha travels around Mar ...
分类:
其他好文 时间:
2020-01-12 09:35:46
阅读次数:
84
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. Example: Input: 3 Output: [ [1,null,3,2], ...
分类:
其他好文 时间:
2020-01-08 12:43:14
阅读次数:
72
Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n? Example: Input: 3 Output: 5 Explanation: Given n = 3, the ...
分类:
其他好文 时间:
2020-01-07 13:18:06
阅读次数:
58