蚂蚁不在线

2018年7月29日

leetcode python 032 识别最长合法括号

摘要: # 给定一个只包含字符'('和')'的字符串,# 找到最长的有效(格式良好)括号子字符串的长度。# 对于“(()”,最长的有效括号子串是“()”,其长度为2。# 另一个例子是“)()())”,其中最长的有效括号子串是“()()”,其长= 4def find_long_valid(s): stack, 阅读全文

posted @ 2018-07-29 21:50 蚂蚁不在线 阅读(195) 评论(0) 推荐(0) 编辑

leetcode python 030 Substring with Concatenation of All Words

摘要: ## 您将获得一个字符串s,以及一个长度相同单词的列表。## 找到s中substring(s)的所有起始索引,它们只包含所有单词,## eg:s: "barfoothefoobarman" words: ["foo", "bar"]## return [0,9].def find_sub(s,wor 阅读全文

posted @ 2018-07-29 14:48 蚂蚁不在线 阅读(122) 评论(0) 推荐(0) 编辑

导航