ARTS #130 Algorithm 本周选择的算法题是:Path Sum。 规则 Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equal...
ARTS #129 Algorithm 本周选择的算法题是:Recover a Tree From Preorder Traversal。 规则 We run a preorder depth-first search (DFS) on the root of a binary tree. At each node in this traversal, we output D dashes (where...
ARTS #128 Algorithm 本周选择的算法题是:Reducing Dishes。 规则 A chef has collected data on the satisfaction level of his n dishes. Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is defined...
为什么 OC 不推荐使用 try-catch? 第一次认真注意到 try-catch 的实现细节还是在几年前,那会儿在 Stackoverflow 某一个问题上被大神 Richard J. Ross III 教育了:Try catch is not a good solution, as ARC does not play nicely with it, unless you turn on that compiler flag, whi...
ARTS #127 Algorithm 本周选择的算法题是:Unique Paths III。 规则 You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exactly one starting square. 2 re...
ARTS #126 Algorithm 本周选择的算法题是:LFU Cache。 规则 Design and implement a data structure for a Least Frequently Used (LFU) cache. Implement the LFUCache class: LFUCache(int capacity) Initializes the object ...
ARTS #125 Algorithm 本周选择的算法题是:N-Queens II。 规则 The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return the numbe...
从历史看组织 《从历史看组织》 一本很薄的书,只有 246 页,一两天就可以翻完,作者是著名历史学家许倬云。简单来说,这本书可以概括为从组织、管理的角度,看中国历史,把历朝历代都看做一个公司,分析其在组织管理上的成败得失。 我想重点记录下“人”对组织的影响。 从历史中可以学到,没有一劳永逸的制度,也没有终生智慧的领导,对于所有的制度,不仅要看短期,还要看可持续性。 一个人掌权的时间不能太久,因为一...
ARTS #124 Algorithm 本周选择的算法题是:Combination Sum III。 规则 Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 through 9 are used. Each n...
ARTS #123 Algorithm 本周选择的算法题是:Burst Balloons。 规则 You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the...