Sponsored
Use these hints if you're stuck. Try solving on your own first.
With the constraints, the length of the longest square streak possible is 5.
Store the elements of nums in a set to quickly check if it exists.
Solve with full IDE support and test cases