算法trick

数组从头到尾的循环遍历:

index=(index+1)%length

索引值增加定长,对长度取余,则形成头尾循环。

原文地址:https://www.cnblogs.com/liyeliang/p/9865944.html