Skip to content

Commit 293fbeb

Browse files
committed
move drafts
1 parent cac2afe commit 293fbeb

File tree

2 files changed

+64
-2
lines changed

2 files changed

+64
-2
lines changed

_drafts/2019-05-06-arts_week_5.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: ARTS(第5周)
3+
category: ARTS
4+
tags: arts
5+
---
6+
7+
> **本周提纲:**
8+
>
9+
> 1. Algorithm: 最长公共前缀
10+
> 2. Review: 一个谷歌工程师编码解决问题的过程
11+
> 3. Tip: Jenkins REST API 触发任务执行
12+
> 4. Share: 关于负载均衡的一切(58沈剑)
13+
14+
<!-- more -->
15+
16+
## Algorithm
17+
18+
[14.最长公共前缀](https://leetcode-cn.com/problems/longest-common-prefix/)
19+
20+
### 描述
21+
22+
> 编写一个函数来查找字符串数组中的最长公共前缀。
23+
>
24+
> 如果不存在公共前缀,返回空字符串 ""。
25+
> 示例 1:
26+
>
27+
> 输入: ["flower","flow","flight"]
28+
> 输出: "fl"
29+
>
30+
> 示例 2:
31+
>
32+
> 输入: ["dog","racecar","car"]
33+
> 输出: ""
34+
> 解释: 输入不存在公共前缀。
35+
> 说明:
36+
>
37+
> 所有输入只包含小写字母 a-z 。
38+
39+
### 代码
40+
41+
```python
42+
class Solution:
43+
def longestCommonPrefix(self, strs: List[str]) -> str:
44+
"""
45+
:type strs :List[str]
46+
:rtype str
47+
"""
48+
if len(strs) == 0: return ""
49+
# 按照字母表顺序获取最大值和最小值(进行了简单的排序)
50+
s1, s2 = min(strs), max(strs)
51+
zobj = zip(s1,s2)
52+
rstr = ""
53+
for i,j in list(zobj):
54+
if i != j:
55+
return rstr
56+
rstr += i
57+
return rstr
58+
```
59+
60+
## Review
61+
62+
[rework](https://rework.withgoogle.com/print/guides/5721312655835136/)

_drafts/oodesign/chain-of-responsibility.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ comments: true
4040

4141
```java
4242
public class Request {
43-
private int m_value;
44-
private String m_description;
43+
private int m_value;
44+
private String m_description;
4545

4646
public Request(String description, int value)
4747
{

0 commit comments

Comments
 (0)