Seven's blog

你不会找到路,除非你敢于迷路

0%

ARTS-No.2

Algorithm

整数反转

题解:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Solution {
public int reverse(int x) {
int result = 0;
int temp;
while (x != 0) {
temp = x % 10;

if (result > Integer.MAX_VALUE / 10 || (result == Integer.MAX_VALUE / 10 && Integer.MAX_VALUE - result < temp)) {
return 0;
}

if (result < Integer.MIN_VALUE / 10 || (result == Integer.MIN_VALUE / 10 && Integer.MIN_VALUE - result > temp)) {
return 0;
}

result *= 10;
result += temp;

x = x / 10;
}

return result;
}
}

执行用时: 1ms, 内存消耗: 33.7MB

Review

The 5 Whys Process We Use to Understand the Root of Any Problem

  • 5个为什么常被用来查找问题的根源;
  • 5 个为什么的目的不是为了责备;

5 个为什么的 5 个主要步骤:

  1. 邀请所有被问题影响到的人;
  2. 选出一个会议领导者 (实际上每个人都可以担任这个角色);
  3. 问出 5 次为什么;
    • 如果问题出现分支, 只选择其中的一个分支继续深究;
    • 如果同一个问题再次出现, 我们可以选择其他分支;
    • 最后, 我们会根据 5 个为什么找寻到问题的原因和解决问题的步骤;
  4. 对讨论得出的解决方案进行分工;
  5. 把会议结果发送给公司所有人.

Tip

lightpdf - 在线PDF编辑器及转换器.

Share

部署 Hexo 博客到 VPS

微信公众号
扫码关注, 一起进步!