ARTS-week41

Algorithms

Valid Perfect Square

1
2
3
4
5
6
7
8
9
class Solution {
public:
bool isPerfectSquare(int num) {
for (int i = 1; i <= num / i; ++i) {
if (i * i == num) return true;
}
return false;
}
};

Sum of Two Integers

1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
public:
int getSum(int a, int b) {
if(b == 0) {
return a;
}
int sum, tmp;
sum = a ^ b;
tmp = (a & b & 0x7fffffff) << 1;
return getSum(sum, tmp);
}
};

Review

本周阅读英文文章:
1、Fighting Back Against DDoS Attacks

2、Feature Engineering in Python: Rare values

3、Building Games With Artificial Intelligence

Technique

阅读了RFC2511,学习了X.509证书的请求格式:
https://tools.ietf.org/html/rfc2511

Share

使用PDB进行Python程序的调试:
https://pymotw.com/3/pdb/index.html