ARTS #132 Algorithm 本周选择的算法题是:Minimum Number of Operations to Move All Balls to Each Box。 规则 You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empt... 2021-12-114 min read
ARTS #131 Algorithm 本周选择的算法题是:Partitioning Into Minimum Number Of Deci-Binary Numbers。 规则 A decimal number is called deci-binary if each of its digits is either 0 or 1 without any leading zeros. For examp... 2021-12-042 min read
重视「重要不紧急的」事情 从时间管理角度上看,我们一般会把事情按照四象限法则分为重要紧急的、重要不紧急的、不重要紧急的、不重要不紧急的,而其中最重要的部分可能是 — 重要不紧急的。 为什么说重要不紧急的是最重要的呢?我们可以简单分析下: 重要且紧急的 — 简称救火。传统观念认为要立刻处理,这没有错,但是如果这类事件太多,一定需要思考为什么会有那么多救火的事情,多数原因是没做好规划 重要但不紧急 — 我称... 2021-12-031 min read
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... 2021-11-274 min read
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... 2021-11-204 min read
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... 2021-11-153 min read
为什么 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... 2021-11-133 min read
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... 2021-11-066 min read
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 ... 2021-10-308 min read
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... 2021-10-232 min read