for N=020, M = 101, //2=1+1
why are you adding 0 before 20, just give -1 as the answer.
if adding 0 is allowed then we can give answer for all inputs

for N=999
make it as N=0999, M=1899

On Oct 9, 5:04 pm, wujin chen <wujinchen...@gmail.com> wrote:
> @Aamir , yes, for some N, it will be no ans, then return -1.
>
> 2011/10/9 Aamir Khan <ak4u2...@gmail.com>
>
>
>
>
>
>
>
> > Answer won't be possible in for each N. What would be answer for N=999 ?
>
> > On Sun, Oct 9, 2011 at 4:22 PM, Ankur Garg <ankurga...@gmail.com> wrote:
>
> >> Is it sum of bits or sum of digits ?
>
> >> On Sun, Oct 9, 2011 at 1:39 PM, wujin chen <wujinchen...@gmail.com>wrote:
>
> >>> Given a positive number N, find a minimum number M greater than N, M  has
> >>> the same length with N and the sum of the bits are equal.
>
> >>> example:
> >>> N=134 , M=143,  // 1+3+4=1+4+3
> >>> N=020, M = 101, //2=1+1
>
> >>> the length of N is less than 1000.
>
> >>>  --
> >>> 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.
>
> >>  --
> >> 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.
>
> > --
> > Aamir Khan | 3rd Year  | Computer Science & Engineering | IIT Roorkee
>
> >  --
> > 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.

-- 
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