krahets / hello-algo

《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 代码。简体版和繁体版同步更新,English version ongoing
https://www.hello-algo.com
Other
96.11k stars 12.19k forks source link

If k is greater than the array itself, directly return itself #1401

Closed XiaoK29 closed 2 months ago

XiaoK29 commented 3 months ago

If this pull request (PR) pertains to Chinese-to-English translation, please confirm that you have read the contribution guidelines and complete the checklist below:

If this pull request (PR) is associated with coding or code transpilation, please attach the relevant console outputs to the PR and complete the following checklist:

krahets commented 2 months ago

Thanks for the PR. I personally prefer to keep the code simple.