码迷,mamicode.com
首页 >  
搜索关键字:numbers range    ( 16974个结果
猜数字游戏解析
一、使用函数。 import random:import语句将random模块导入程序中。 guessesTaken = 0:储存猜过的次数。 random.randint():调用random中的randint(x,y)函数,此函数创建一个随机数字。 for i in range(6):range ...
分类:其他好文   时间:2020-04-06 11:43:24    阅读次数:74
[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
[Algo] Find Pair with Given Sum
Given a list of positive integers nums and an int target, return indices of the two numbers such that they add up to a target - 30. Conditions: You wi ...
分类:其他好文   时间:2020-04-06 09:49:05    阅读次数:76
204. Count Primes
Problem : Count the number of prime numbers less than a non negative number, n. Example: 思路 : Solution (C++) : 性能 : Runtime: 208 ms Memory Usage: 6.6 ...
分类:其他好文   时间:2020-04-06 00:11:19    阅读次数:84
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!