title: Given a number, find the next higher number which has the exact same set of digits as the original number
body: <p>I just bombed an interview and made pretty much zero progress on my interview question.</p>
  <blockquote>
  <p>Given a number, find the next higher number which has the exact same
  set of digits as the original number. For example: given 38276 return
  38627</p>
  </blockquote>
  <p>I wanted to begin by finding the index of the first digit (from the right) that was less than the ones digit. Then I would rotate the last digits in the subset such that it was the next biggest number comprised of the same digits, but got stuck.</p>
  <p>The interviewer also suggested trying to swap digits one at a time, but I couldn't figure out the algorithm and just stared at a screen for like 20-30 minutes. Needless to say, I think I'm going to have to continue the job hunt.</p>