其实有原题, "生成树计数" 然鹅这题里面是两道题, 50pts 可以用 "上面那题的做法" 直接过掉,另外 50pts 要推推式子,搞出 O n 的做法才行(毕竟多项式常数之大您是知道的) 虽说这道题里面是没有 a_i 的,也不用分治合并多项式的就是了,所以大致思路看我另一题的题解就好了,这里对于 ...
分类:
其他好文 时间:
2019-05-14 17:42:38
阅读次数:
143
这是悦乐书的第 333 次更新,第 357 篇原创 01看题和准备 今天介绍的是LeetCode算法题中Easy级别的第203题(顺位题号是868)。给定正整数N,找到并返回N的二进制表示中两个连续1之间的最长距离。如果没有连续两个1,则返回0。例如: 输入:22 输出:2 说明:22的二进制是10 ...
分类:
其他好文 时间:
2019-05-14 09:48:36
阅读次数:
95
Given a binary tree, return the preorder traversal of its nodes' values. Example: My idea:ricursion OTHERS:iretator ...
分类:
其他好文 时间:
2019-05-13 22:47:43
阅读次数:
115
Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, ...
分类:
其他好文 时间:
2019-05-13 20:18:35
阅读次数:
112
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2019-05-13 12:40:32
阅读次数:
130
SUID :Set UID 1 SUID 权限仅对二进制程序(binary program)有效 2 执行者对于该程序需要具有x的可执行权限 3 本权限仅在执行该程序的过程中有效(run-time) 4 执行者将具有该程序拥有者(owner)的权限 SGID:Set GID 1 SGID 可以针对文 ...
分类:
系统相关 时间:
2019-05-13 00:52:07
阅读次数:
227
671. 二叉树中第二小的节点 671. Second Minimum Node In a Binary Tree 题目描述 给定一个非空特殊的二叉树,每个节点都是正数,并且每个节点的子节点数量只能为 2 或 0。如果一个节点有两个子节点的话,那么这个节点的值不大于它的子节点的值。 给出这样的一个二 ...
分类:
其他好文 时间:
2019-05-12 13:44:35
阅读次数:
118
原题链接: http://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ 这道题是树中比較有难度的题目。须要依据先序遍历和中序遍历来构造出树来。这道题看似毫无头绪。事实上梳理一下还 ...
分类:
其他好文 时间:
2019-05-12 12:23:36
阅读次数:
120
Binary Search 时间复杂度 O(logN ), 因为每次减少一半 相当于取log Q: 什么时候可以用Binary Seach? A: 当数据是Sorted 并且支持Random Access的时候 Binary Search 的基本规则 1. 搜索空间在循环中不断减小 The Sear ...
分类:
其他好文 时间:
2019-05-12 01:17:00
阅读次数:
102
Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identi ...
分类:
其他好文 时间:
2019-05-11 21:42:17
阅读次数:
96