yesterday I witnessed some interesting for loop (the classic one) hacks by chatgpt that were interesting to say the least
in js you can start at index 1, to compare current with prev, and when it reaches length + 1 it is just undefined and you can use that to your advantage
in java (not js) they just use a check to avoid out of bounds, since it triggers an error, shit's smart brub