当前位置:网站首页>LeetCode 1894.找到需要补充粉笔的学生编号
LeetCode 1894.找到需要补充粉笔的学生编号
2022-08-10 05:32:00 【生信研究猿】
python
class Solution:
def chalkReplacer(self, chalk: List[int], k: int) -> int:
sum_chalk = 0
for i in range(len(chalk)):
sum_chalk += chalk[i]
if(k>sum_chalk):
k = k%sum_chalk
i = 0
while(1):
k -= chalk[i%len(chalk)]
# print(k)
if(k<0):
break
i +=1
return i%len(chalk)
边栏推荐
猜你喜欢

Chain Reading | The latest and most complete digital collection calendar-07.28

Chain Reading|The latest and most complete digital collection sales calendar-07.29

Collection tool class

Batch add watermark to pictures batch add background zoom batch merge tool picUnionV4.0

十年磨一剑!数字藏品行情软件,链读APP正式开放内测!

Count down the six weapons of the domestic interface collaboration platform!

String常用方法

transaction, storage engine

树结构——2-3树图解

tinymce rich text editor
随机推荐
力扣——情侣牵手
LeetCode 剑指offer 10-I.斐波那契数列(简单)
先人一步,不再错过,链读APP即将上线!
智能合约和去中心化应用DAPP
知识蒸馏论文学习
操作表 函数的使用
A little knowledge point every day
网络安全3
ACID四种特性
卷积神经网络(CNN)实现mnist手写数字识别
Bifrost micro synchronous database implementation services across the library data synchronization
el-cascader级联选择器的子菜单双击两次才显示被选中的内容
微信小程序--模板与设置WXML
.NET操作Excel高效低内存的开源框架 - MiniExcel
Linux数据库Oracle客户端安装,用于shell脚本用sqlplus连接数据库
One step ahead, don't miss it again, the chain reading APP will be launched soon!
21天挑战杯MySQL-Day05
GUI_AWT
Day1 微信小程序-小程序代码的构成
树结构——二叉查找树原理与实现