It also just occurred to me that this is O(n^2).  Can we do this without the recursive call?