果粒陈33
果粒陈33
全部文章
题解
归档
标签
去牛客网
登录
/
注册
果粒陈33的博客
全部文章
/ 题解
(共16篇)
题解 | #井字棋#
# -*- coding:utf-8 -*- class Board: def checkWon(self, board): # write code here # 最笨的办法,每种情况都考虑,逐一排查 if board[0][0] + bo...
Python2
Python3
2022-06-19
0
329
题解 | #无缓存交换#
# -*- coding:utf-8 -*- class Exchange: def exchangeAB(self, AB): # write code here # 使用异或性质 AB[0] ^= AB[1] AB[1] ...
Python2
Python3
2022-06-19
0
323
题解 | #最近公共祖先#
# -*- coding:utf-8 -*- class LCA: def getLCA(self, a, b): # write code here # 因为是按顺序排列的满二叉树,所以可以根据性质计算 while a != b: ...
Python2
Python3
2022-06-19
0
351
题解 | #判断直线相交#
# -*- coding:utf-8 -*- class CrossLine: def checkCrossLine(self, s1, s2, y1, y2): # write code here if s1 == s2 and y1 == y2: # 直...
Python2
2022-06-18
0
344
题解 | #碰撞的蚂蚁#
# -*- coding:utf-8 -*- import math class Ants: def antsCollision(self, n): # write code here return 1 - math.pow(0.5, n-1)
Python2
Python3
2022-06-18
0
378
题解 | #整数转化#
# -*- coding:utf-8 -*- class Transform: def calcCost(self, A, B): # write code here temp = A ^ B counter = 0 ...
Python2
2022-06-18
0
319
首页
上一页
1
2
下一页
末页