当前位置:网站首页>[hero planet July training leetcode problem solving daily] 21st pile
[hero planet July training leetcode problem solving daily] 21st pile
2022-07-22 11:48:00 【Seven water Shuliang】
[ Hero planet July training LeetCode Problem solving daily ] The first 21 Japan Pile up
daily
subject
One 、 2336. The smallest number in an infinite set
link : 2336. The smallest number in an infinite set
1. Title Description
2. Thought analysis
- Because the actual range is only 1024 You can actually use SortedSet simulation .
- SortedList The practice can be seen from my previous weekly game solutions .
3. Code implementation
class SmallestInfiniteSet:
def __init__(self):
from sortedcontainers import SortedSet
self.q = SortedSet(range(1,1001))
def popSmallest(self) -> int:
return self.q.pop(0)
def addBack(self, num: int) -> None:
self.q.add(num)
边栏推荐
- 基于JSP+Servlet+MySQL+Bootstrap+CSS的图书管理系统
- Search for matching files or directories under folders glob ()
- Binary search / half search
- Multithreading and high concurrency day09
- PHP利用Redis 事务实现商品秒杀
- 底线
- Online shopping mall e-commerce system based on ssm+mysql+bootstrap+jquery
- Medicine management system based on ssm+mysql+jquery
- Findcontours and drawcontours & image contours (I) & cv2 boundingRect and cv2. rectangle
- Embedded sharing collection 18
猜你喜欢
Overloading and rewriting
"Money laundering"
伙伴云戴志康:如何利用低代码提升研发和IT效能
PR
Use of PHP generator yield performance optimization
BGP border gateway protocol
Meta: predict the potential impact of the metauniverse from the development and innovation of mobile technology
lc marathon 7.21
论文分享目标检测、图像分割、监督学习等
News blog publishing system based on jsp+servlet+mysql
随机推荐
Classic interview questions of interface testing: what is the difference between session, cookie and token?
Is it just an illusion that the encryption market soared to more than $1trillion? The crypto bear market is far from bottoming out
Viewport scaling method to solve the self adaptation of mobile terminal
【学习笔记】带你从0开始学习 01Trie
移动端Web App 的屏幕适配方法(总结)
Framework customization series (10) -- systemui customization status bar statusbar and navigation bar tutorial
Using virtual to implement hooks in solidity
"Money laundering"
[learning notes] take you to learn 01trie from 0
IP第十二天笔记
[unicloud] application and improvement of cloud objects
What is the value of continuous delivery?
二分查找/折半查找
Grafana monitoring node
【英雄哥七月集训】第 21天:无限集中的最小数字
苹果因键盘不好使赔3.4亿,SpaceX接单韦布后继者,META起诉Meta,今日更多新鲜事在此
重载与重写
MySQL Varchar前缀索引的一个细节
TZC 1283: simple sort - quick sort
OSPF comprehensive experiment