当前位置:网站首页>2022.8.2-----leetcode.622
2022.8.2-----leetcode.622
2022-08-03 09:42:00 【路Lu727】
int k, he, ta;
int[] nums;
public MyCircularQueue(int _k) {
k = _k;
nums = new int[k];
}
public boolean enQueue(int value) {
if (isFull()) return false;
nums[ta % k] = value;
return ++ta >= 0;
}
public boolean deQueue() {
if (isEmpty()) return false;
return ++he >= 0;
}
public int Front() {
return isEmpty() ? -1 : nums[he % k];
}
public int Rear() {
return isEmpty() ? -1 : nums[(ta - 1) % k];
}
public boolean isEmpty() {
return he == ta;
}
public boolean isFull() {
return ta - he == k;
}
边栏推荐
猜你喜欢

Redis cluster concept and construction

STP生成树(端口状态+端口角色+收敛机制 )|||| STP优化技术( uplinkfast技术+Portfast技术+backbonefast技术 )详解

Promise 一: 基本问题

MySQL 中 is null 和 =null 的区别

selenium IDE的3种下载安装方式

10 Convolutional Neural Networks for Deep Learning 2

MySQL——几种常见的嵌套查询

MySQL_关于JSON数据的查询

AD环境搭建

SQL Daily Practice (Nioke New Question Bank) - Day 5: Advanced Query
随机推荐
Oracle数据库表空间整理回收与释放操作
ClickHouse删除数据之delete问题详解
10 minutes to get you started chrome (Google) browser plug-in development
SQL试题
子查询和关联查询的区别
面试突击71:GET 和 POST 有什么区别?
013-Binary tree
AD环境搭建
Unity笔记之简陋的第一人称漫游
redis实现分布式锁的原理
MySQL8重置root账户密码图文教程
响应式布局经典范例——巨幅背景大标题
MySQL的存储过程
"Easy to use" websites that others don't know, make you more efficient
基于百度AI和QT的景物识别系统
DOM0、DOM2、DOM3 事件
验证浮点数输入
milvus
Mysql OCP 27题
Mysql OCP 29题