Adobe Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

What exactly was the question ?

- ghantacoder February 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Didn't understand your Q's?

- ariesgirl069 March 02, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Example: For any given number n, we need to count all the numbers from 1 to n, which doesn't contain 3.

- Gaurav March 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int num=45;
int count=0;
for(int i=1;i<=num;i++)
{
int temp=i;
boolean flag=false;
while(temp>0)
{
if((temp%10)==3)
{
flag=true;
break;
}
temp=temp/10;
}
if(!flag)
{
count++;
System.out.print(i + " ");
}
}

System.out.println(count);

- durai March 05, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

/*If i am getting the right question then My Answer is */
int main()
{
  int endNum = 0, count = 1, result = 0;
  cin>>"Enter the End Number"<<endNum;
  while(count <= endNum)
  {
       if((count%10==3)||(count/10==3));
       else
       {
             cout<<count<<"\t";
             result++;
       }   
       count++;
  }
cout<<endl<<"Total numbers without 3 is "<<result;
return 0;
}

- Ankur Mittal March 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Here u people are checking each number.Optimize the solution,come up with some good solution...........:)

- Gaurav March 06, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hi Gaurav, I think u are having something in ur mind. if it is then pls share with us also.

- Ankur Mittal March 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hi Gaurav, I think u are having something in ur mind. if it is then pls share with us also.

- Ankur Mittal March 07, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

This can be done with mathematics using java

length = log10n+1; //Total length of 'n'
sum=8 // sum of numbers without 3 and 0 starting with one digit no.

for(int i=1;i<length-2;i++)
{

sum+= sum*9; //9 is for adding 0 and excluding 3

}

//For last digit
int last = n/pow(10,length-1);

if(last<3)
sum+=last* pow(9,length-1)

if(last>=3)
sum+=(last-1)*pow(9,length-1);

Time: log10n;

- Nish March 29, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Optimized solution is to subtract from n the number of cases where 3 exists. For 2 digit number, if decimal digit is greater than 3, then 3 can exist 10 times in decimal digit with 0-9 comes in 1 digit. For 1 digit, it can come till 4(0-4) ie - 03,13,23,33,43 - 5 times. In this way it can be optimized. Only in 3-4 comparisons we can find x (number of times 3 exists in the numbers from 1 - n) and then result = n - x.

- Saurabh May 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@saurabh ... Why to subtract ?

I think if you are removing a element from the Decimal System .. then we should add (not subtract) the number of times that specific element was present before the given number.

like ... 3 will become 4 and the number system will look like .. 0,1,2,4,5 ... 12,14, 15, .. 29,40 ... and so on ...

- Tarunjit Singh May 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@saurabh ... Why to subtract ?

I think if you are removing a element from the Decimal System .. then we should add (not subtract) the number of times that specific element was present before the given number.

like ... 3 will become 4 and the number system will look like .. 0,1,2,4,5 ... 12,14, 15, .. 29,40 ... and so on ...

- Tarunjit Singh May 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int main()
{

cout<<"Decimal - 3"<<endl;

int i = 0, j = 0 , temp;

int n = 14 ;// Input your number here 

while(i<=n)
{
   temp = i;
  // cout<<"In while1 - j :"<<j<<"  temp :"<<temp<<endl;
   bool Flag = false;  
 while(temp>0 && !Flag)
   {
  //   cout<<"     temp :"<<temp<<endl;
     if(temp%10 == 3)
     {
      j++;
   //   cout<<"   In while2 - j :"<<j<<endl;
      Flag = true;
      
     }
     temp = temp/10;
   }

i++,j++;
}

cout<<"j : "<<j-1<<endl;

return 0;
}

- Tarunjit Singh May 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Suppose we consider we need to find no. of numbers from 1 t0 50 not divisible by 3.

Lets find the how many are divisible by 3 .
50 /3 =16
16 /3 =5
5 / 3 = 1
We keep on dividing the integral part of the quotient till the quotient is less than 3.
total count of numbers divisible by 3= 16+5+1= 22.

hence number not divisible by 3= 50-22 =28

- Keep Trying May 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I am not getting what exactly are you trying to say.
can you please explain what are you trying to do by counting the numbers not divisible by 3 ?

- Tarunjit Singh May 25, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

In this in previous comments all are finding the numbers does not contain 3.
i don't think this is what the question says...

they want to define the new number system where 3 is not there.
So for defining new number system we have to define its new adding and subtraction properties.
0 1 2 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20.....
Addition means moving forward and subtraction means moving back.
So 1+2=4 not 3
2+2=5 not 4 as moving 2 position we reach at 5.
So i think we have to find one way to do this.

- Anonymous December 28, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More