刘拾柒的个人博客

健康、成长、赚钱

Algorithm

771. 宝石与石头

  • 解法一:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    class Solution {
    public int numJewelsInStones(String J, String S) {
    int total = 0;
    StringBuffer oldString = new StringBuffer(S), newString = new StringBuffer();
    for (int j = 0; j < J.length(); j++) {
    char current = J.charAt(j);
    for (int s = 0; s < oldString.length(); s++) {
    char stone = oldString.charAt(s);
    if (stone == current) {
    total += 1;
    continue;
    }
    newString.append(stone);
    }
    oldString = new StringBuffer(newString);
    newString = new StringBuffer();
    }

    return total;
    }
    }

    执行用时: 4ms, 内存消耗: 35.7MB.

阅读全文 »

见闻

  • 61岁中国大爷靠“玩”木头火了,网友:简直是宝藏爷爷!

    文章介绍了一位把传统手艺玩成精的木工爷爷. 当擅长和热爱指向一处, 往往能发挥出无穷潜力.

    另, 网络以及自媒体的普及, 确实让真正有才华的人被看见.

  • Java 之父:你至少得会两门语言

    文章介绍了 Java 之父 James Gosling 的传奇经历, 文中有段话我觉得十分优秀:

    你投入到程序中的精力越多,用户使用时遇到麻烦和折腾的精力就会越少,程序员要做的,正是在开发端和用户端之间尽量平衡开发和用户使用的复杂度。

阅读全文 »

前言

Hexo + Github Pages 本是绝顶搭配, 无奈最近国内访问速度越来越慢, 实在不忍直视.

虽说国内也有 Gitee.com 和 Coding.net 提供类似服务, 但都不完全免费, 甚至还有广告, 不在考虑范围之内.

最终只好忍痛买了个云主机, 开启博客搬迁之旅.

阅读全文 »

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

阅读全文 »

前言

分享一些自己喜欢的 Windows 软件, 希望能够帮助大家提高工作 / 学习效率.

系统安装

这里只介绍我喜欢用的工具, 不作深入探讨.

  • WePE

    简洁纯净的 PE 系统.

  • 系统

    纯净 Windows 镜像.

  • 驱动

    建议到主板官网下载, 不推荐使用 驱动精灵, 驱动人生 等流氓软件.

    阅读全文 »
0%