Loops

Nested for-loops

Generally, they are a bad idea, but not always. They are perfect if they describe the correct algorithm e.g. if we need to access every value in a matrix

Tips for avoiding

Does sorting the array first help you?