快手
笔试-快手-180910
Index
字符串归一化
from collections import Counter
s = input()
c = Counter(s)
res = ""
for key in sorted(c.keys()):
res += key
res += str(c[key])
print(res)魔法深渊
善变的同伴
print(new_ns) # [6, -2, 3, -10, 3]
去掉首尾的负数块
print(new_ns) # [6, -2, 3, -10, 3]
按奇偶划分奇数和偶数块
print(cnt_pos) # 3
print(ns_pos) # [6, 3, 3]
print(ns_neg) # [-2, -10]
如果 M 的值小于正数块的数量则进行合并
最后更新于
这有帮助吗?