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练习-判断一个空列表和最长的连续序列
2025-6-26
Python练习-对字典进行赋值
2025-6-25
vi/vim如何进行多行的添加、删除、替换
2025-6-16
使用ollama+ragflow构建医疗助手大模型demo
2025-6-11
Python练习-add
2025-5-16
Pytorch中的TensorBoard如何使用
2025-5-8