If it is the first largest ?

On Sep 21, 8:02 pm, Dave <dave_and_da...@juno.com> wrote:
> @Prasanth: Since there is no requirement to find the next larger
> number, you can go for the largest. Extract the digits into an array
> using modulus and division by 10. Then sort the digits into descending
> order. Finally, construct the answer by repeated multiplication by 10
> and addition.
>
> If you want, you can check to see if the resulting number is greater
> than the original and return an error code if it is just equal to it.
> E.g., 8755 already has its digits in decreasing order, so the above
> algorithm will reproduce 8755.
>
> Dave
>
> On Sep 21, 8:53 am, prasanth n <nprasnt...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You have given a positive number you have to find a number which is bigger
> > than that by using same digits available in the number .
> > Example :-
> > You have given a number 7585 , your output should be 7855 .
>
> > --
> > *prasanth*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to