首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
Dejack
北京邮电大学
2020届
后端开发
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(33)
连续子数组的最大和
1
Python solution using dp: def FindGreatestSumOfSubArray(self, array): dp = [0 for _ in range(len(array))] for i in range(len(arra...
发表于 2019-02-25 21:22:29
判断是不是平衡二叉树
0
1.普通递归,计算从根节点开始 class Solution: def IsBalanced_Solution(self, pRoot): if not pRoot: return True leftDepth = self.getD...
发表于 2018-11-05 21:46:05
顺时针打印矩阵
1
python solution: 方法一:一个圈一个圈的加,还要避免重复 略麻烦 def printMatrix(self, matrix): if not matrix: return [] res = [] row ...
发表于 2018-11-01 19:49:44
滑动窗口的最大值
32
Python solution 1. 利用python性质每次求固定size的最大值,时间复杂度O(n*size) res, i = [], 0 while size > 0 and i + size - 1 < len(num): res.append(max(...
发表于 2018-10-24 22:07:14
把二叉树打印成多行
1
Python sulution: 顺便吐槽一下牛客网剑指offer题目顺序不对,之字形的二叉树打印居然在层级遍历前面。。 class Solution: # 返回二维列表[[1,2],[4,5]] def Print(self, pRoot): # write...
发表于 2018-10-19 16:34:22
对称的二叉树
0
Python solutuion: def comRoot(self, pLeft, pRight): if not pLeft and not pRight: return True elif not pLeft or not pRight: re...
发表于 2018-10-18 17:05:25
二叉树的下一个结点
0
Python solution: def GetNext(self, pNode): if not pNode: return None if pNode.right: pNode = pNode.right while pNode....
发表于 2018-10-18 16:32:12
链表中环的入口结点
1
Python solution: def EntryNodeOfLoop(self, pHead): # write code here p = [] while pHead: if pHead in p: ...
发表于 2018-10-17 20:39:42
字符流中第一个不重复的字符
0
Python solution: 前面也出现过好几次找重复字符或数字的题了,除了暴力循环外主要还有哈希表,做异或异或运算。 def __init__(self): self.s = '' self.Hash = {} #python dict 本身就是哈希表...
发表于 2018-10-16 21:01:34
构建乘积数组
0
Python solution: def multiply(self, A): # write code here 分头尾两部分 if not A: return [] B = [] head, tail = [1], [1] for i i...
发表于 2018-10-15 11:09:05
首页
上一页
1
2
3
4
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题