https://leetcode-cn.com/problems/rotate-list/
function rotateRight(head: ListNode | null, k: number): ListNode | null {
if (k === 0 || !head || !head.next) return head;
let len = 1;
let cur = head;
// 计算总长度
while (cur.next) {
len++;
cur = cur.next;
}
k = k % len;
// k 取模为 0 直接返回
if (k === 0) return head;
// 需要移动的步数
let pos = len - k;
cur.next = head;
while (pos) {
cur = cur.next;
pos--;
}
const res = cur.next;
cur.next = null;
return res;
}
Progress
<div class="tabs">
<div class="tabs-header">
<div class="nav-item nav-item-active">
选项卡一
</div>
<div class="nav-item">
选项卡二
</div>
</div>
<div class="tabs-content">
<progress max="100" value="40" />
<progress max="100" value="100"></progress>
<progress max="100" value="60"></progress>
</div>
</div>
.tabs {
width: 960px;
height: 850px;
margin: 48px auto;
padding: 24px;
box-sizing: border-box;
}
.tabs-header {
display: flex;
align-items: center;
margin-left: -2px;
}
.nav-item {
height: 55px;
line-height: 50px;
padding-right: 30px;
text-align: center;
width: 256px;
font-weight: 800;
font-family: PingFangSC-Semibold;
font-size: 18px;
color: #fff;
text-align: center;
position: relative;
}
.nav-item::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
border-radius: 20px 20px 0 0;
transform: scaleY(1.3) perspective(3em) rotateX(5deg);
transform-origin: bottom left;
background: #22222E;
}
.nav-item-active {
color: #B04DFF;
}
.nav-item-active::after {
border: 2px solid #B04DFF;
border-bottom: #22222E;
}
.nav-item-active::before {
content: '';
height: 2.5px;
position: absolute;
bottom: -2px;
z-index: 2;
left: 2px;
right: 2px;
background-color: #22222E;
}
.tabs-content {
position: relative;
padding: 75px;
box-sizing: border-box;
height: 100%;
background: #22222E;
border-radius: 0 24px 24px 24px;
border-top: 2px solid #B04DFF;
}
.tabs-content::before {
content: '';
position: absolute;
z-index: -1;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
border-radius: 0 24px 24px 24px;
background: linear-gradient(#c815ff 0%, #22222e 150px);
}
progress {
width: 600px;
height: 10px;
background-color: transparent;
margin-bottom: 82px;
}
progress::-webkit-progress-bar {
border-radius: 5px;
background-color: transparent;
}
progress::-webkit-progress-value {
border-radius: 5px;
background-image: linear-gradient(45deg, #385df2 0%, #c815ff 100%);
}