you don't need to pass in a startIndex and endIndex since this method is not being called recursively and the implementation can get those values from the passed in set