码迷,mamicode.com
首页 >  
搜索关键字:rmq range minimummax    ( 10438个结果)
[LeetCode] 938. Range Sum of BST 二叉搜索树的区间和
Given the node of a binary search tree, return the sum of values of all nodes with value between and (inclusive). The binary search tree is guaranteed ...
分类:其他好文   时间:2020-04-06 09:50:46    阅读次数:73
leetcode-5379-石子游戏③
题目描述: 方法:从后向前dp class Solution(object): def stoneGameIII(self, A): n = len(A) dp = [-float('inf')] * n for i in range(n-1,-1,-1): dp[i] = max(dp[i], s ...
分类:其他好文   时间:2020-04-05 20:12:32    阅读次数:61
西游记 词频统计
1 import jieba 2 txt=open("D://python_common_exercise//west_journey.txt",'r',encoding="utf-8").read() 3 words=jieba.lcut(txt) #jieba库函数 4 count={} #创建 ...
分类:其他好文   时间:2020-04-05 18:29:41    阅读次数:148
python +selenium 实现图片对比功能
#encoding=utf-8 from selenium import webdriver import unittest, time from PIL import Image class ImageCompare(object): ''' 本类实现了对两张图片通过像素比对的算法,获取文件的像素 ...
分类:编程语言   时间:2020-04-05 13:37:51    阅读次数:214
leetcode1404
1 class Solution: 2 def convertInt(self,s): 3 n = len(s) 4 basenum = 0 5 p = 0 6 for i in range(n-1,-1,-1): 7 basenum += int(s[i]) * (2 ** p) 8 p += 1 ...
分类:其他好文   时间:2020-04-05 13:22:02    阅读次数:69
数组的转置
1 #导入numpy模块 2 import numpy as np 3 a = np.arange(1,25).reshape(8,3) 4 print(a) 5 print('transpose函数进行数组转置a[i][j] a[j][i]') 6 b = a.transpose() 7 prin ...
分类:编程语言   时间:2020-04-05 11:45:04    阅读次数:51
leetcode1399
1 class Solution: 2 def calSum(self,x): 3 s = str(x) 4 sums = 0 5 for j in range(len(s)): 6 sums += int(s[j]) 7 return sums 8 9 def countLargestGroup( ...
分类:其他好文   时间:2020-04-05 09:52:40    阅读次数:50
动态规划(4)
class Solution: def maxValue(self, grid: List[List[int]]) -> int: for i in range(len(grid)): for j in range(len(grid[0])): if i == 0 and j == 0: conti ...
分类:其他好文   时间:2020-04-05 09:49:46    阅读次数:44
leetcode1400
1 class Solution: 2 def canConstruct(self, s: str, k: int) -> bool: 3 #奇数个字符出现的数量 <= k 4 #所有的字符的类别数量 >= k 5 dic = dict() 6 n = len(s) 7 for i in range ...
分类:其他好文   时间:2020-04-05 09:44:32    阅读次数:73
单例模式
1,单例模式的实现,基于new方法实现 """ import threading class Singleton(object): instance = None lock = threading.RLock() def __new__(cls, args, kwargs): if cls.inst ...
分类:其他好文   时间:2020-04-04 20:56:23    阅读次数:52
共10438条   上一页 1 ... 86 87 88 89 90 ... 1044 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!