@dave
is 1/17 recurring...??
@abhirup
now convert float to string ..only part after decimal

now let the string be .346346346.....
take an auxilarry array a[0--9]..initialize it to zero
as you encounter update inceremnt a[s[i]-48]
wheneva you element in tha array becomes 2
store i-1
now from 0 to i-1 is the desired answer




On Fri, Jul 2, 2010 at 3:45 PM, Abhirup Ghosh <abhiru...@gmail.com> wrote:

> Can you please elaborate on the solution you have with auxiliary array?
>
>
>
> On Fri, Jul 2, 2010 at 3:53 AM, jalaj jaiswal <jalaj.jaiswa...@gmail.com>
> wrote:
> >
> > we are given with  Numerator and Denominator. After division we might get
> a
> > recurring decimal points float as the answer.
> > For example 23.34563456 ...
> > return 3456 i.e the recurring part
> >
> >
> >
> >
> > i did it by converting the decimal part into string(itoa).. then a scan
> to
> > find the first repeated character ...then outputting the string upto that
> > location of first character-1
> >  i found first repeated character using an auxilarry array[0..9]..
> > total 3 scans.. O(n)
> >
> > any better solutions please ??
> > --
> >
> >
> >
> >
> > With Regards,
> > Jalaj Jaiswal
> > +919026283397
> > B.TECH IT
> > IIIT ALLAHABAD
> >
> > --
>  > You received this message because you are subscribed to the Google
> Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
With Regards,
Jalaj Jaiswal
+919026283397
B.TECH IT
IIIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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