Tuesday, July 30, 2013

Building an RF remote control

Thought Works placement Experience


Hi guys,

      Today, I attended the Company named "Thought Works".

      First round is simple but we have to concentrate to crack it. Its nothing but solving the "Flowchart" given by them. There are only 11 questions and the time limit is 1hr and 15 mins.I tried all the 11 questions.

      So, I got shortlisted for the next round called "Short coding round". In this round, we have to do programming in any platform like C or C++ or JAVA... I used the Turbo C compiler.
The question asked by them is
      We have to get two strings and remove the characters from first string that is entered in second string. For example, If the first string as "Programming world" and second string as "aeiou", then the output will be "Prgrmmng wrld".

      Due to some technical problem I can't able to solve within the 30 minutes given by them. But I done with the program after the time goes off.

C program to do the above is given as follows:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    char *s1,*s2,*s3,*temp;
    int len1,len2,i=0,j=0,k,c=0;
    gets(s1);
    gets(s2);
    len1=strlen(s1);
    len2=strlen(s2);
    s3=s1;
    temp=s1;
    for(i=0;i<len1;((c==1)?i:i++))
    {
       c=0;
       for(j=0;j<len2;j++)
       {
          if(temp[i]==s2[j])
          {
            k=i;
            c=1;
            while(s1[k])
            {
               temp[k]=temp[k+1];
               k++;
            }
         }
       }
    }
    printf("%s",s3);
    getch();
}

      This program is very simple. This is Case sensitive. If you done with this, they asking you to do the same as Case Insensitive.

      To do that, replace the condition in line 18 by given line:

         if((temp[i]==s2[j])||(temp[i]==((s2[j]<=90 && s2[j]>=65)? (s2[j]+32) : (s2[j]-32) )))

       After that Long Coding round and then HR Interview...
    
      A little advice: 
  •     Before you get started, write the steps or algorithms of what you are going to program... It is very useful while programming...
  •     How you Applying your mind on that time matters guys... 
                                     Prepare well... All the best guys...

My company Logo