[CHALLENGE] Possibility's

Everything PHP-related! Discuss scripts, host challenges, request a script, or just ask for plain old help.

Moderators: IRC Operators, Support Team

Srankie
User
User
Posts: 963
Joined: Thu Mar 01, 2007 7:16 pm
Location: #godscript #msl HOLLAND

[CHALLENGE] Possibility's

Postby Srankie » Tue Oct 07, 2008 12:30 pm

Hello.

You have to make a function that returns all possibility's of a given number, they should be all under each other, in the source code.

For example; echo possibility(1); returns "0\1\n\2\n\3\n\4\n\5\n\6\n\7\n\8\n\9\n"
It does not matter what order they are!

It should work with all numbers, it will be judged on speed


Rules:

    Will be judged on speed
    Deadline is on 14/10 any time that day, so don't leave it till the last moment.
    Function name is: possibility
    Any way of socketing to something is disallowed
    include is disallowed to!
    Entry should be send on forums, with the title possibility() Nth entry


Questions:

Q: Do you mean multiples?
A: Read third post.
Last edited by Srankie on Tue Oct 07, 2008 5:17 pm, edited 4 times in total.
Image
Image
User avatar
Hova
User
User
Posts: 656
Joined: Sat Oct 04, 2008 9:14 pm

Postby Hova » Tue Oct 07, 2008 12:39 pm

Do you mean multiples?
Image
[url=http://my.opera.com/tobylane/affiliate]Image
<Vivec> Don't mess with toby guys; he's a professional troll.[/url]
Srankie
User
User
Posts: 963
Joined: Thu Mar 01, 2007 7:16 pm
Location: #godscript #msl HOLLAND

Postby Srankie » Tue Oct 07, 2008 12:41 pm

I should have given more examples.
The number should be 0 to 9.

I mean like a code with 4 numbers has 4^4 possibility's.
It should return all those possible codes.

I don't know if that gives your answer, if it doesn't, just ask again
Image
Image
User avatar
Hova
User
User
Posts: 656
Joined: Sat Oct 04, 2008 9:14 pm

Postby Hova » Tue Oct 07, 2008 12:46 pm

0 to N, each string N length?
Image

[url=http://my.opera.com/tobylane/affiliate]Image

<Vivec> Don't mess with toby guys; he's a professional troll.[/url]
Srankie
User
User
Posts: 963
Joined: Thu Mar 01, 2007 7:16 pm
Location: #godscript #msl HOLLAND

Postby Srankie » Tue Oct 07, 2008 12:53 pm

The input in possibility is 1 to unlimited.

It should give every possible code there is.
With 1 is that 0 1 2 3 4 5 6 7 8 9
with 2 is that 00 01 02 03 04 05 06 07 08 09 10 11 12 14 15 etc
with 3 is that 000 001 100 010 etc etc

in the source it should be under each other, so you have to return it with \n between each other, I think you get it now :D?
Image
Image
slushpuppy
User
User
Posts: 873
Joined: Sun Jul 16, 2006 2:23 pm

Postby slushpuppy » Tue Oct 07, 2008 3:51 pm

Your checking function doesn't make any sense :\
-
Srankie
User
User
Posts: 963
Joined: Thu Mar 01, 2007 7:16 pm
Location: #godscript #msl HOLLAND

Postby Srankie » Tue Oct 07, 2008 5:17 pm

Ya I know, I removed it, I will remake it later
Image
Image
Manacit2
User
User
Posts: 442
Joined: Fri Nov 24, 2006 2:39 am

Postby Manacit2 » Wed Oct 08, 2008 2:43 am

Edit: Removed
ImageImage
may not be right, but it is a lot of the time!
User avatar
oliver
User
User
Posts: 1716
Joined: Thu Sep 21, 2006 10:23 am
Location: A cardboard box that miracualously has internet...
Contact:

Postby oliver » Wed Oct 08, 2008 9:38 am

your not sposed to post it on the forums manacit <.<
Srankie
User
User
Posts: 963
Joined: Thu Mar 01, 2007 7:16 pm
Location: #godscript #msl HOLLAND

Postby Srankie » Wed Oct 08, 2008 1:54 pm

And it should return it, not echo
And please remove it and send it just by my forum mail
Image
Image
Manacit2
User
User
Posts: 442
Joined: Fri Nov 24, 2006 2:39 am

Postby Manacit2 » Wed Oct 08, 2008 10:18 pm

ah, my bad
I thought "Entry should be send on forums, with the title possibility() Nth entry" meant post it.
ImageImage

may not be right, but it is a lot of the time!

Return to “PHP”

Who is online

Users browsing this forum: No registered users and 1 guest