LeetCode – Perfect Squares

题目: 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 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n = 13 Output: 2 Explanation: 13 = 4 + 9. 解题1: 数学方式的解法:基于四平方和理论(Lagrange’s four-square theorem), 每个正整数均可表示为4个整数的平方和。 ...

2019-07-02 · 3 min · 1153 words · Garlic Space

linux 任务状态定义

Linux task_struct 结构中 涉及进程状态的属性有三个,其中进程对应的状态分为两类, 一类是运行中状态, 另一类是进程退出状态。

2019-06-29 · 5 min · 2492 words · Garlic Space

Netflix Blog-令人愉快的用户界面:复活节彩蛋

这篇文章 Delightful User Interfaces: Easter Eggs 是出自 Netflix Technology Blog

2019-06-27 · 2 min · 570 words · Garlic Space

文件签名及校验方法

在上网下载镜像或安装文件时经常会看到MD5,SHA-1,SHA-256 ,signature,一起显示,这些文件帮助我们验证下载的文件是否损坏或者被篡改以及文件的真实性, 散列值可以使用windows, macOS,Linux内置命令进行验证。 文件签名可以使用工具gpg进行校验。

2019-06-27 · 3 min · 1273 words · Garlic Space

LeetCode – Open the Lock

题目: You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot. The lock initially starts at '0000', a string representing the state of the 4 wheels. ...

2019-06-23 · 2 min · 549 words · Garlic Space

Netflix Blog-容器的预测性CPU隔离

这篇文章 Predictive CPU isolation of containers at Netflix 是出自 Netflix Techno

2019-06-20 · 2 min · 668 words · Garlic Space

Posix Threads API 整理

定义: 并发与并行: 并发(concurrency):实际上串行发生的事情好像同时发生,表述了单核处理器中线程或者进程的行为特点 并行(parallelism):并发序列同时执行, 真正的并行只能在多处理其上存在。 异步与同步: 异步(asynchronous)与同步(synchronous)区别在于发需求的人是否需要等到需要完成才可以执行其他事情。 ...

2019-06-20 · 22 min · 10942 words · Garlic Space

insmod: ERROR: could not insert module *.ko: Unknown symbol in module

在实际编译运行 什么是RCU :API 中的例子 rcu_example时报错

2019-06-17 · 1 min · 287 words · Garlic Space

LeetCode – Number of Islands

题目: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: 1 2 3 4 5 6 7 Input: 11110 11010 11000 00000 Output: 1 Example 2: Input: 11000 11000 00100 00011 Output: 3 ...

2019-06-17 · 2 min · 653 words · Garlic Space

什么是RCU :API

详解 Linux 内核 RCU 的 API 接口和使用方法

2019-06-15 · 1 min · 417 words · Garlic Space