liqueur 最近的时间轴更新
liqueur

liqueur

V2EX 第 119127 号会员,加入于 2015-05-27 14:06:30 +08:00
liqueur 最近回复了
2018-03-22 16:50:15 +08:00
回复了 RicardoScofileld 创建的主题 Python 今天面试的一道算法题,求教
@liqueur 哇 v2 的代码支持不行啊
2018-03-22 16:49:30 +08:00
回复了 RicardoScofileld 创建的主题 Python 今天面试的一道算法题,求教
N = [1, 2, 3, 4, 5]
M = 3
'''
output = [{1,2,3}{1,2,4},{1,2,5},{2,3,4},{2,3,5}{3,4,5}]
'''

output = []

for ix, x in enumerate(N):
for iy, y in enumerate(N[ix + 1:]):
for iz, z in enumerate(N[iy + 1:]):
if(y - x) == 1 and z > y:
output.append({x, y, z})

print(output)
2015-10-16 14:20:57 +08:00
回复了 LaughingMeMe 创建的主题 职场话题 我们老板说我的茶轴太响了,影响其他同事了。
家里有个青轴高键帽的机械键盘 入手时 699 元 后来感觉用来写代码好累啊 于是换回了 87 元的地摊双飞燕 感觉好多了 2333
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2026 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 01:56 · PVG 09:56 · LAX 18:56 · JFK 21:56
Developed with CodeLauncher
♥ Do have faith in what you're doing.