@anshu- your code works fine.....but can you plz explain how you concluded
this code....i mean what's the logic behind to check   myset.size() > psize
?? ...........as you are assuming  that it will be increase string and check
until this condition satisfies ??
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
<http://gplus.to/amolsharma99>
<http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99>





On Wed, Oct 12, 2011 at 10:29 AM, shady <[email protected]> wrote:

> thanks a lot for replying to the post... but try posting algorithm rather
> than actual code...
>
> On Mon, Oct 10, 2011 at 2:17 PM, anshu mishra 
> <[email protected]>wrote:
>
>> string all1Multiple(int x)
>> {
>> string s;
>> set<int> mySet;
>> mySet.push(0);
>> int psize, r=1;
>> do
>> {
>> psize = mySet.size();
>> s += '1';
>> r = r % x;
>> mySet.push(r);
>> r = r * 10 + 1;
>> } while(mySet.size() > psize);
>>
>> if (r != 1) return "not Possible";
>> return s;
>>
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to