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-4-9
Python练习-count、remove、append、extend
2025-4-8
Python练习-set和sorted
2025-4-6
Python练习-insert和del
2025-4-6
Python练习-range
2025-4-6
Python练习-双指针法
2025-4-6