Working with arrays and complexity