ARTS-week-06

每周完成一个ARTS: 每周至少做一个 leetcode 的算法题、阅读并点评至少一篇英文技术文章、学习至少一个技术技巧、分享一篇有观点和思考的技术文章。(也就是 Algorithm、Review、Tip、Share 简称ARTS)

1.Algorithm

Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

Example 1:

1
2
Input: "()"
Output: true

Example 2:

1
2
Input: "()[]{}"
Output: true

Example 3:

1
2
Input: "(]"
Output: false

Example 4:

1
2
Input: "([)]"
Output: false

Example 5:

1
2
Input: "{[]}"
Output: true

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
mapping = {
'(': ')',
'[': ']',
'{': '}'
}
stack = []
for c in s:
if c in mapping:
stack.append(c)
else:
if not stack or mapping[stack.pop()] != c:
return False
return False if stack else True

2.Review

可以翻译,锻炼自己的阅读和英语能力。

英文文章可以去自己想要学习的技术官网获取,或者自己喜欢的公司 blog

An Introduction to Big Data Concepts and Terminology

系统概述了大数据行业及解释了相关术语

https://www.digitalocean.com/community/tutorials/an-introduction-to-big-data-concepts-and-terminology

3.Tip

生活技巧,学习技巧、工具

如何让Markdown另起一页

  • Markdown支持HTML语法

    1
    <div style="page-break-after: always;"></div>

4.Share

ffmpeg简单使用(1)-转码、添加字幕

https://paranoid-kid.github.io/2019/04/30/ffmpeg简单使用-1/

小明 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
0%