Added updated code for kthSmallestNumber