江南201901122252794
江南201901122252794
全部文章
分类
题解(14)
归档
标签
去牛客网
登录
/
注册
江南201901122252794的博客
全部文章
(共14篇)
Python解法
# -*- coding:utf-8 -*- #2020秋招vivo算法题二题源 class Solution: def LastRemaining_Solution(self, n, m): if n < 1: return -1 ...
2019-11-04
0
415
Python解法:二分
思路参考 drdr # -*- coding:utf-8 -*- from bisect import bisect_left class Solution: def GetNumberOfK(self, data, k): # write code here ...
2019-11-04
0
409
Python解法:哈希
思路类似字符串第一个出现一次的字符差不多 # -*- coding:utf-8 -*- from collections import Counter#哈希解法 class Solution: # 返回[a,b] 其中ab是出现一次的两个数字 def FindNumsAppearOn...
2019-11-04
0
422
Python解法:哈希
class Solution: def FirstNotRepeatingChar(self, s): # write code here l=[0]*256 for i in s:#记录每个字符出现的次数 l[ord(...
2019-11-04
0
412
Python解法:动态规划
''' dp解法 dp[i]表示到 0-i之间连续最大和 则状态转移方程为: dp[i]=max(array[i],dp[i-1]+array[i]) ''' class Solution: def FindGreatestSumOfSubArray(self, array): ...
2019-11-03
0
381
Python解法:实现快排
#考察排序那就手动实现以下快排 顺便熟悉下O(nlogn) python中的sort()时间复杂度就是O(nlogn) class Solution: def GetLeastNumbers_Solution(self, tinput, k): # write code h...
2019-11-03
0
436
Python解法
# -*- coding:utf-8 -*- class Solution:#不用count() 时间复杂度为O(n) def MoreThanHalfNum_Solution(self, numbers): # write code here if not...
2019-11-03
0
445
python解法Queue容器实现bfs
#熟悉Queue容器的 的 .put() .get() .empty()用法 # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.lef...
2019-11-02
0
418
python四指针法
# -*- coding:utf-8 -*- ''' 思路很简单,直接模拟这个过程采用四个指针来控制遍历 top=0 ── ── → ┐ right=len(matirx[0]) ┌...
2019-11-01
0
374
python递归解法
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None cl...
2019-11-01
0
412
首页
上一页
1
2
下一页
末页