https://leetcode-cn.com/problems/rotate-list/

    1. function rotateRight(head: ListNode | null, k: number): ListNode | null {
    2. if (k === 0 || !head || !head.next) return head;
    3. let len = 1;
    4. let cur = head;
    5. // 计算总长度
    6. while (cur.next) {
    7. len++;
    8. cur = cur.next;
    9. }
    10. k = k % len;
    11. // k 取模为 0 直接返回
    12. if (k === 0) return head;
    13. // 需要移动的步数
    14. let pos = len - k;
    15. cur.next = head;
    16. while (pos) {
    17. cur = cur.next;
    18. pos--;
    19. }
    20. const res = cur.next;
    21. cur.next = null;
    22. return res;
    23. }

    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%);
    }