Algorithm
每周至少做一个 Leetcode 的算法题。
roman-to-integer
class Solution {
public int romanToInt(String s) {
s = s.replace("IV","a");
s = s.replace("IX","b");
s = s.replace("XL","c");
s = s.replace("XC","d");
s = s.replace("CD","e");
s = s.replace("CM","f");
int res = 0;
int length =s.length();
for (int i = 0; i < length; i++) {
res += getValue(s.charAt(i));
}
return res;
}
public int getValue(char c) {
switch(c) {
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
case 'a': return 4;
case 'b': return 9;
case 'c': return 40;
case 'd': return 90;
case 'e': return 400;
case 'f': return 900;
}
return 0;
}
}
Review
阅读并点评至少一篇英文技术文章。
How to Terminate Stuck or Unwanted User Sessions in Linux
也许会想到ctrl+c
;文章更细致的介绍通过 w
kill
等命令结束进程;
https://linuxiac.com/how-to-terminate-user-session-in-linux/
Tip
学习至少一个技术技巧。
时间有限,不可能什么都学,学习最重要的学习!
Share
分享一篇有观点和思考的技术文章。
流水线之版本tag
欢迎关注公-众-号【TaonyDaily】、留言、评论,一起学习。
Don’t reinvent the wheel, library code is there to help.
若有帮助到您,欢迎点赞、转发、支持,您的支持是对我坚持最好的肯定(_)
你要保守你心,胜过保守一切。
作者:刘俊涛的博客