LeetCode --- 2073. Time Needed to Buy Tickets 解题报告

Question

There are n people in a line queuing to buy tickets, where the 0th person is at the front of the line and the (n - 1)th person is at the back of the line.

You are given a 0-indexed integer array tickets of length n where the number of tickets that the ith person would like to buy is tickets[i].

Each person takes exactly 1 second to buy a ticket. A person can only buy 1 ticket at a time and has to go back to the end of the line (which happens instantaneously) in order to buy more tickets. If a person does not have any tickets left to buy, the person will leave the line.

Return the time taken for the person at position k (0-indexed) to finish

相关推荐

  1. LeetCode --- 2073. Time Needed to Buy Tickets 解题报告

    2024-06-17 07:28:05       8 阅读
  2. LeetCode --- 2000. Reverse Prefix of Word 解题报告

    2024-06-17 07:28:05       41 阅读
  3. LeetCode --- 2032. Two Out of Three 解题报告

    2024-06-17 07:28:05       28 阅读
  4. LeetCode --- 2057. Smallest Index With Equal Value 解题报告

    2024-06-17 07:28:05       17 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-17 07:28:05       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-17 07:28:05       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-17 07:28:05       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-17 07:28:05       18 阅读

热门阅读

  1. ES6-04-模块化的暴露:export关键字

    2024-06-17 07:28:05       9 阅读
  2. ActiViz中不规则网络数据体绘制技术介绍

    2024-06-17 07:28:05       8 阅读
  3. C# OpenCvSharp 图像处理函数-颜色通道-cvtColor

    2024-06-17 07:28:05       4 阅读
  4. 【R语言入门】开启R的会话并大步向前!

    2024-06-17 07:28:05       10 阅读
  5. 解决小程序的异步请求问题

    2024-06-17 07:28:05       5 阅读
  6. flutter中采用腾讯云COS进行图片存储

    2024-06-17 07:28:05       6 阅读
  7. MongoDB PHP 教程

    2024-06-17 07:28:05       5 阅读
  8. 深入理解 CMake 的 `cmake --build` 命令

    2024-06-17 07:28:05       8 阅读
  9. 三、树和割集

    2024-06-17 07:28:05       6 阅读