• Lucid Dreaming - Dream Views




    Results 1 to 7 of 7

    Hybrid View

    1. #1
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935

      Talking Ninja's Software Challenge

      Here's a simple programming challenge for all of you. For each challenge, you get 5 points for writing code that does what it's supposed to. 1 - 4 points for code that doesn't work, depending on how close it it. In a few days I'll write my own code for each challenge, and you get five points if you code runs faster than mine and 5 points if your code uses less memory than mine

      You can use either C or C++ and any of the STL.

      I think it'll give you guys some good practice as well as learn from a pro.

      Spoiler for Challenge 1:


      Spoiler for Challenge 2:


      Spoiler for Challenge 3:


      Spoiler for Challenge 4:


      Spoiler for Challenge 5:
      Last edited by ninja9578; 06-11-2009 at 01:46 PM.

    2. #2
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      I have a few questions:
      May we search online for solutions to things we don't know how to do?
      If so where is the limit? Like, it's ok to search for a function reference, but not for more complicated things, or?
      Are we supposed to use everything you've written in your code, or can we change from type const char * to std::string if we wish?
      When or if we complete the task, shall we post it here with code, post it here with link to code, or PM you with the code or a link to it?

      Edit: Also, you've written the wrong description in challenge 5.
      Last edited by khh; 06-11-2009 at 02:33 AM.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    3. #3
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Post your code, you can look up whatever you want from algorithms to function references.

    4. #4
      dsr
      dsr is offline
      我是老外,可是我會說一點中文。
      Join Date
      Nov 2006
      Gender
      Location
      my mind
      Posts
      374
      Likes
      1
      I'll take care of the two easiest and leave the rest for ye who hath more time on thy hands.

      Spoiler for 1:


      Spoiler for 2:
      Last edited by ninja9578; 06-11-2009 at 01:45 PM.

    5. #5
      khh
      khh is offline
      Remember Achievements:
      1000 Hall Points Veteran First Class
      khh's Avatar
      Join Date
      Jun 2009
      Gender
      Location
      Norway
      Posts
      2,482
      Likes
      1309
      Ok, I think I've solved the 4 first. I'm a bit confused by the fifth, though. Either there're 1 item too little in the array, or I'm missing something.
      Spoiler for Challenge 1:

      Spoiler for challenge 2:

      Spoiler for challenge 3:

      Spoiler for challenge 4:


      Also, it'd be nice if other people hide their code too. So that the ones who come here to try can find their own solutions, and don't get influenced by the ones that have been posted.
      April Ryan is my friend,
      Every sorrow she can mend.
      When i visit her dark realm,
      Does it simply overwhelm.

    6. #6
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      I added spoiler tags around dsr's code. I also altered the 5th one, seems I forgot a value in the array, and some C compilers don't allow #defines inside of the main method

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •