locked
Be ready for Coding Challenge RRS feed

  • Question

  •  

    Best of luck for Coding Challenge

    Enjoy 2 days with ur mind

    Friday, September 21, 2007 5:43 PM

All replies

  • Best of luck Rajkumar and to all other fellow student rockstars.

    Have a wonderful coding challenge with the correct spirit.
    Friday, September 21, 2007 5:47 PM
  • Can I use STL in Coding Challenge???

     

    Friday, September 21, 2007 5:49 PM
  •  

    wat is STL?
    Friday, September 21, 2007 5:54 PM
  • I am not sure whether it is available or not. During the quiz days, get in touch with a live representative of devsquare(u will find it after registering for quiz when it starts) he/she will answer you through live chat

    @Rajkumar
    STL is used in C++. It is Standard Template Library.
    Friday, September 21, 2007 6:14 PM
  • STL is Standard Template Library

     

    like

     

    #include <iostream>
    #include <cstdlib>
    #include <vector>

    using namespace std;
    class BinaryCode
    {
          public:
                 string itoaa(int num)
              {
                     string str;
                        int rem;
                     if (num==0)
                     {
                     str="0";
                     return str;
                     }
                     while(num>0)
                     {
                           rem=num%10;
                     rem+=48;
                     str=(char)rem+str;
                     num/=10;
                     }
                return str;
             }
             int atoii(char a)
             {
                    int num;
                    num=a;
                    num-=48;
                    return num;
                    }
                 vector <string> decode(string message)
                 {
                   vector <string> s1;
                        int num1,num2,str1=1,str2=1;
                        string dec_string[2];
                        dec_string[0]="0";
                        dec_string[1]="1";
                        for (int i=0;i<message.length();i++)
                        {
                            if (i==0)
                            {
                                     num1=atoii(message[0]);
                                     num2=(atoii(message[0]))-1;
                                     }
                            else
                            {
                                if (str1==1)
                                num1=(atoii(messageIdea))-(atoii(dec_string[0]Idea))-(atoii(dec_string[0][i-1]));
                                if (str2==1)
                                num2=(atoii(messageIdea))-(atoii(dec_string[1]Idea))-(atoii(dec_string[1][i-1]));
                                }
                            if ((num1!=0)&&(num1!=1))
                            {
                                str1=0;
                                dec_string[0]="NONE";
                                }
                            else
                            if (i!=(message.length()-1))
                             dec_string[0]+=itoaa(num1);
                            if ((num2!=0)&&(num2!=1))
                            {
                                str2=0;
                                dec_string[1]="NONE";
                                }
                            else
                            if (i!=(message.length()-1))
                             dec_string[1]+=itoaa(num2);
                            }
                        s1.push_back(dec_string[0]);
                        s1.push_back(dec_string[1]);
                        return s1;
                               
                 }
    };

     

    Friday, September 21, 2007 6:15 PM
  • @Imran

    Just now had a live chat with devsquare representative. He said you can use STL..

    So good news for you mate.
    Friday, September 21, 2007 6:18 PM
  • what ia STL?

    Friday, September 21, 2007 6:33 PM
  • Guys, in the last student rockstar contest, we had one quiz in which we HAD to use the STL libraries, so you can freely use the STL libraries. The compiler i guess is the GNU GCC compiler, so follow that standard.


    @Piyush - http://www.sgi.com/tech/stl/ <-- you can find all the info about STL there
    Friday, September 21, 2007 8:25 PM