ARTS-week48

Algorithms

N-ary Tree Level Order Traversal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;

Node() {}

Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public:
vector<vector<int>> levelOrder(Node* root) {
vector<vector<int>> res;
if (!root) {
return res;
}
helper(root, 0, res);
return res;
}

void helper(Node* node, int level, vector<vector<int>>& res)
{
if (res.size() <= level) {
res.resize(res.size() + 1);
}
res[level].push_back(node->val);
for(auto i : node->children) {
helper(i, level + 1, res);
}
}
};

Number of Segments in a String

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Solution {
public:
int countSegments(string s) {
int res = 0, n = s.size();
for (int i = 0; i < n; ++i) {
if (s[i] == ' ') {
continue;
}
++res;
while (i < n && s[i] != ' ') ++i;
}
return res;
}
};

Review

本周阅读英文文章:
1、The Masochistic Gaming Ecstasy of Super Mario ‘Kaizo’ Hacks

2、SNMP Arbitrary Command Execution

Technique

通过Process Monitor的日志来确认程序的行为

下载地址:
https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

Process Monitor会列出程序访问过的注册表项目和文件。注册表是Windows系统提供给应用程序的一个用于保存配置信息的数据库,其中保存的数据包括浏览器设置、文件类型关联、用户密码等。

Share

一直在忙,这周该部分为空。

0%