I just got down voted because my answer was correct but inefficient (another answer showed that something could be done in O(n). my answer did it in O(n^2). Now, the question didn't mention - this should be done in O(n) . So, I gave the first(and perhaps the simplest) solution.
My question is simple (and I completely agree with the down voter that my answer is indeed inefficient). Is it fine to down vote a correct answer because it is inefficient?