ARTS 2020-6-22 ~ 2020-6-28

ARTS是由左耳朵耗子陈皓在极客时间专栏《左耳听风》中发起的一个每周学习打卡计划。

1
2
3
4
5
6
7
Algorithm:至少做一个 LeetCode 的算法题。主要为了编程训练和学习。

Review:阅读并点评至少一篇英文技术文章。主要为了学习英文,如果你英文不行,很难成为技术高手。

Tip:学习至少一个技术技巧。主要是为了总结和归纳你日常工作中所遇到的知识点。

Share:分享一篇有观点和思考的技术文章。主要为了输出你的影响力,能够输出你的价值观。

1. Algorithm(算法)

LeetCode 160、剑指 Offer 52 相交链表

题目地址:剑指 Offer 52. 两个链表的第一个公共节点

160. 相交链表

解法1

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
public class Solution {
/**
* For example, the following two linked lists:
A: a1 → a2

c1 → c2 → c3

B: b1 → b2 → b3
begin to intersect at node c1.
time : O(n);
space : O(1);
* @param headA
* @param headB
* @return
*/
public a160_相交链表.cspiration.ListNode getIntersectionNode(a160_相交链表.cspiration.ListNode headA, a160_相交链表.cspiration.ListNode headB) {
if (headA == null || headB == null) return null;

/* 获取链表长度 */
int lenA = len(headA);
int lenB = len(headB);

/* 将较长链表的指针向前移动 */
if (lenA > lenB) {
while (lenA != lenB) {
headA = headA.next;
lenA--;
}
} else {
while (lenA != lenB) {
headB = headB.next;
lenB--;
}
}

/* 同时移动两个元素,直到遇到相同元素 */
while (headA != headB) {
headA = headA.next;
headB = headB.next;
}
return headA;
}

public int len(ListNode head) {
int len = 1;
while (head != null) {
head = head.next;
len++;
}
return len;
}
}

解法2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
public class Solution {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
// 边界检查
if (headA == null || headB == null) return null;

ListNode a = headA;
ListNode b = headB;

// 如果a&b有不同的len,那么我们将在第二次迭代后停止循环
while (a != b) {
// 对于第一次迭代的结束,我们只是将指针重置为另一个链表的头部
a = a == null ? headB : a.next;
b = b == null ? headA : b.next;
}

return a;
}
}

参考链接

https://www.youtube.com/watch?v=1bWqD_MwWuw

https://leetcode-cn.com/problems/intersection-of-two-linked-lists/solution/tu-jie-xiang-jiao-lian-biao-by-user7208t/

《程序员面试金典(第6版)》

2. Review(点评)

程序员简历的常见错误(英文)

这篇文章总结了程序员写简历时的几个注意点,下面是其中几个。

1. 筛选你的技能

不要试图提及你掌握的所有技能,这会给人一种”万事通”的感觉。

2. 按熟练程度分级技能

将你的技能分成三个等级:”精通”(proficient in)、”有实战经验”(experienced with)、”熟悉”(familiar with)。

3. 添加细节

“精通”和”有实战经验”的技能,必须提供细节,要给出项目内容和你的个人成果。

4. 避免拼写和语法错误

5. 将“教育”块移到底部

6. 保持外观简洁

7. 保持在一页上(最好)

8. 使其具有相关性(最好)

并不意味着每家公司都有一份简历,但也不必一定要有一张履历表来统治所有的履历表。如果你要申请多个职位或不同行业的公司,创建多个变体可能是一个有趣的想法。

3. Tip(技巧)

iead 复制代码然后粘贴会自动创建类

4. Share(分享)

分享你认为值得订阅的内容 | Notion 小活动 Vol.13

https://wweb.dev/resources/css-separator-generator

打赏
  • 版权声明: 本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
  • Copyrights © 2015-2023 高行行
  • 访问人数: | 浏览次数:

请我喝杯咖啡吧~

支付宝
微信