definitely the most straightforward solution, but when you see O(n^2) you should automatically assume there's a better way to do it. Never an issue to mention this as your first pass, some interviewers will want you to do it the naive way and then improve upon it, but probably qualify that with "I can do better than O(N^2)"