果粒陈33
果粒陈33
全部文章
分类
题解(23)
归档
标签
去牛客网
登录
/
注册
果粒陈33的博客
全部文章
(共23篇)
题解 | #买卖股票的最好时机(一)#
# # # @param prices int整型一维数组 # @return int整型 # class Solution: def maxProfit(self , prices ): # write code here # 动态规划 ...
Python2
Python3
2022-06-20
0
292
题解 | #判断链表中是否有环#
# class ListNode: # def __init__(self, x): # self.val = x # self.next = None # # # @param head ListNode类 # @return bool布尔型 # cl...
Python2
Python3
2022-06-20
0
344
题解 | #求二叉树的前序遍历#
# class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # # # @param root TreeN...
Python2
Python3
2022-06-20
0
400
题解 | #访问单个节点的删除#
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Remove: def removeN...
Python2
Python3
2022-06-20
0
484
题解 | #另类加法#
# -*- coding:utf-8 -*- class UnusualAdd: def addAB(self, A, B): # write code here while B: C = A ^ B B = ...
Python2
Python3
2022-06-20
0
423
题解 | #词频统计#
# -*- coding:utf-8 -*- class Frequency: def getFrequency(self, article, n, word): # write code here n = 0 for s in articl...
Python2
Python3
2022-06-20
0
341
题解 | #井字棋#
# -*- 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 -*- 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
首页
上一页
1
2
3
下一页
末页