英语单词的学习是没有尽头的,Holly 和holy两个单词就相差了一个字母,意思完全不一样,前者是一种植物冬青,或者常用作女性的名字霍莉,后者是神圣的意思,发音也很接近,Holly比holy的元音更短促一些。再讲两个我觉得比较有趣的单词,purgatory 人间炼狱,leisure 安逸。以后快乐,不再是 joy,cheer或者happiness,也不是pleasure,而是leisure。痛苦不再是sadness,sorrow,despair,也不是grief,而是purgatory。瞬间,英文的文学修养就出来了。 Wuthering heights becloud 遮蔽 discomfiture 狼狈 discomfit,fail glimpse glance,see,notice embrace 拥抱 hug dusky dusk 黄昏 embellishment decoration,ornaments scent smell,fragrance utensils 器具 tools deck 甲板 Holly 冬青,霍莉 speck fleck,spot,freckle,speckle,stain breed 孕育 overcast beclouded afresh adv. start afresh,resume lurk 隐藏 hide,sneak up the stairs,crept the stairs glint shine,flash,gleam frank 坦白的 open vicious 邪恶的 evil cur 坏蛋 sulk angry disguise 伪装 mask,cover,hide shove push,thrust impertinence 无礼 rival 对手 opponents gripe hold tightly dishcloth 抹布 blush 脸红 flush expostulate argue purification 净化 handkerchief 方巾 brute animal gush 喷涌 purgatory 炼狱 victual 粮食 food entreaty beg deficiency shortages,absence gloom dim,bleak,dark trumpet 小号 glee joy,delight confine lockup,restrain,jail,imprison converse chat and counterparts leisure 安逸 prognosticate 语言 prophecy obstinate stubborn,rigid dungeon 地牢 cottage 屋舍 remembrance 回想 rake 耙子 rake a comb lament grieve hector intimidate,spite 吓唬 redemption 补偿 compensation ferocity cruel 残忍 代码 感觉自己还是不喜欢用递归,创建一个n维数组,依次摆放从1到n的组合。 1加左括号 2加右括号 3看在不在已有的可能性中 4弹出右括号 5弹出左括号 class Solution: def generateParenthesis(self, n: int) -> List[str]: lis1 = ['()'] lis2 = [[] for i in range(n)] lis2[0] =lis1 for i in range(1,n): for l in lis2[i-1]: str2lis=list(l) lenth = len(str2lis) for j in range(lenth): str2lis.insert(j,'(') for k in range(j+1,lenth+1): str2lis.insert(k,')') lis2str = ''.join(str2lis) #print(999,lis2str) if lis2str not in lis2[i]: lis2[i].append(lis2str) str2lis.pop(k) str2lis.pop(j) return lis2[n-1] 第二题 明知山有虎,偏向虎山行,我把子串进行了全排列,超出求解时间范围 class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: import copy if len(s)>150: return [] lenth = len(words) posi = [[] for i in range(lenth)] posi[0]=[[words[0]]] #print(posi) for i in range(1,lenth): list1 = copy.copy(posi[i-1]) for str1 in list1: lenth2 = len(str1) #print(posi,lenth2) for j in range(lenth2+1): str1.insert(j,words[i]) a = copy.copy(str1) posi[i].append(a) str1.pop(j) #print(posi) lis1 = [] for i in posi[lenth-1]: #print(i) str1 = ''.join(i) if str1 not in lis1: lis1.append(str1) print(lis1) re =[] for ele in lis1: for start in range(len(s)): if s[start] ==ele[0]: sign=0 for i in range(len(ele)): if start+i<len(s): if ele[i]!= s[start+i]: sign =1 else: #if i < len(ele)-1: sign = 1 if sign==0 : re.append(start) return re 先这样吧。。。人与人还是有智力差距的。。。 |
|
来自: 昵称48979411 > 《待分类》