首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
vandesa003
北京大学
2019届
算法工程师
关注
私信
加入黑名单
举报TA
首页
刷题
圈子
项目
笔记
基本资料
真题试卷
在线编程
心理测试
回答的问题(14)
替换空格
0
解法一:迭代,遇到空格向后移动2个位置,然后添加%20。从后往前查找,移动次数更少。 解法二:用队列,非空格入队出队,空格在队尾添加%20即可,用空间换时间。
发表于 2018-10-05 17:34:24
二维数组中的查找
0
在左下角时,向右递增,向上递减,判断当前值与目标值大小关系即可。
发表于 2018-10-05 17:30:02
整数中1出现的次数(从1到n整数中1出现的次数)
0
# -*- coding:utf-8 -*- class Solution: def NumberOf1Between1AndN_Solution(self, n): # write code here count = 0 for i in r...
发表于 2018-06-19 16:57:32
连续子数组的最大和
0
# -*- coding:utf-8 -*- class Solution: def FindGreatestSumOfSubArray(self, array): # write code here if len(array)==0: ...
发表于 2018-06-19 16:10:19
最小的K个数
0
# -*- coding:utf-8 -*- class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code here if k>len(tinput): ...
发表于 2018-06-19 12:17:34
数组中出现次数超过一半的数字
0
# -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers): # write code here if not numbers or len(number...
发表于 2018-06-19 11:44:53
从上往下打印二叉树
0
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None cl...
发表于 2018-06-15 21:35:51
包含min函数的栈
1
# -*- coding:utf-8 -*- class Solution: def __init__(self): self.data = [] def push(self, node): # write code here retu...
发表于 2018-06-14 21:08:51
顺时针打印矩阵
1
# -*- coding:utf-8 -*- class Solution: # matrix类型为二维列表,需要返回列表 def printMatrix(self, matrix): # write code here res = [] ...
发表于 2018-06-14 20:57:30
反转链表
153
看了一下好像没有python的非递归实现。思路很简单:1->2->3->4->5,遍历链表,把1的next置为None,2的next置为1,以此类推,5的next置为4。得到反转链表。需要考虑链表只有1个元素的情况。图中有具体的每步迭代的思路,最后输出pre而不是cur是因为...
发表于 2018-06-14 18:29:37
首页
上一页
1
2
下一页
末页
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题