type
status
date
slug
summary
tags
icon
password

一、前言

今天刷的题目是《旋转数组》

二、题目描述

notion image
notion image

三、解题思路

看这个题的时候感觉就像是队尾出栈,队首入栈的感觉。所以先将队尾的值insert(插入)到队首,再del(删除)掉队尾的值。
insert:作用于list上,用法是list.insert(index,obj);index代表的是插入的索引位置,obj是插入的值。
del:可以从列表中根据索引来删除一个元素

四、解决问题的脚本

 

五、结果

notion image
 
Python练习-双指针法Python练习-set和sorted
Loading...
JucanaYu
JucanaYu
干饭人,干饭魂🍚
最新发布
Python练习-add
2025-5-16
Pytorch中的TensorBoard如何使用
2025-5-8
deepspeed转huggingface格式
2025-5-5
在大模型的训练文件中加入swanlab来监控实验进程
2025-4-29
Python练习-类型转换
2025-4-9
Python练习-count、remove、append、extend
2025-4-8