ARTS-No.5
Algorithm
26. 删除排序数组中的重复项
解法一:
1 | class Solution { |
执行用时: 1ms, 内存消耗: 41.5MB.
ARTS-No.4
wine 应用程序全局快捷键无效的解决方案
前言
在 Ubuntu 下我们经常会使用 Wine 或者 Crossover 运行 Windows 应用程序. 当应用程序切换到后台时, 是无法响应预设的全局快捷键的. 比如”打开微信”的快捷键 ctrl + alt + w 在这种情况下就无法响应.
我们可以借助一个小工具 xdotool 来解决这个问题.
注:
- 此方法在 Ubuntu 17, 18, 19 全系列测试通过, 其他平台未作测试, 理论通用;
- 本文以 “打开微信” 快捷键为例, 其他应用以此类推;
方法
1. 安装 xdotool
直接在命令行运行以下命令即可:
1 | sudo apt install --no-install-recommends xdotool |
ARTS-No.3
Algorithm
771. 宝石与石头
解法一:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21class 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.