checkio的一些题
来源:互联网 发布:西安黑马程序员地址 编辑:程序博客网 时间:2024/06/05 14:38
Xs and Os Referee:
def checkio(l):
for i in l:
if i[0] == i[1] and i[0] == i[2] and i[0] != '.':
return i[0]
for i in range(3):
if l[0][i] == l[1][i] and l[0][i] == l[2][i] and l[0][i] != '.':
return l[0][i]
if l[0][0] == l[1][1] and l[0][0] == l[2][2] and l[0][0] != '.':
return l[0][0]
if l[0][2] == l[1][1] and l[0][2] == l[2][0] and l[0][2] != '.':
return l[0][2]
return "D"
First of Tubis for Binary count:
checkio
=
lambda
x:
bin
(x).count(
'1'
)
def checkio(text):
l = []
for i in text:
if i == '(' or i == '[' or i == '{':
l.append(i)
if (len(l) != 0) and (i == ')' and l[-1] == '(' or i == ']' and l[-1] == '[' or i == '}' and l[-1] == '{'):
l.pop()
elif i == ')' or i == ']' or i == '}':
return False
if len(l) == 0:
return True
return False
checkio("(((1+(1+1))))]")
def checkio(text):
l = []
for i in text:
if i == '(' or i == '[' or i == '{':
l.append(i)
if (len(l) != 0) and (i == ')' and l[-1] == '(' or i == ']' and l[-1] == '[' or i == '}' and l[-1] == '{'):
l.pop()
elif i == ')' or i == ']' or i == '}':
return False
if len(l) == 0:
return True
return False
:
text = text.lower()
m = {}
for letter in text:
if not letter.isalpha():
continue
if letter not in m:
m[letter] = 1
else:
m[letter] += 1
a = sorted(m.items(), key=lambda m: m[1], reverse=True)
return a[0][0]
- checkio的一些题
- checkio的一些题:Speech Module,Feed Pigeons,Roman numerals,Golden Pyramid,The Most Numbers,Digits Multipl
- checkio--
- checkio -- Open Labyrinth python BFS的使用
- CheckIO题解:OLD LIBRAY 里的部分题目
- Python checkio Transposed Matrix map与zip的使用
- checkio (Brackets)
- Python Checkio
- Checkio--Friends
- checkio-medium
- CheckIO 中位数
- checkio (Determine the order)
- checkio (Numbers Factory)
- checkio (How much gold)
- checkio (Counting tiles)
- checkio (URL Normalization)
- checkio (water jars)
- checkio (Digging a canal)
- Android 服务类Service 的详细学习
- OCP 1Z0 051 55
- mac ox上设置Android环境变量 和 环境变量问题
- Tomcat中JVM内存溢出及合理配置
- SQL Server 触发器
- checkio的一些题
- Mysql最新驱动jar包存在bug?
- 十七道海量数据处理面试题与Bit-map详解
- Asp.net Mvc 多级控制器 路由重写 及 多级Views目录 的寻找视图的规则
- IT类研究生入行最高25万 一年干两年活
- 小弟今天看到有些模块周围一圈都是邮票孔,不知道哪位大侠做过邮票孔焊盘,可否告知一下画法,不胜感激!!!
- JQuery日记_5.20 JQuery对Sizzle选择器的扩展
- android.library.reference.1值变成绝对路径在windows下有bug
- 判断DataTable中否存在指定列