InMobi Interview Question for Software Engineer / Developers


Team: InMobi
Country: India
Interview Type: In-Person




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

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

First ugly no is 1 when i=j=k=0; i,j,k belongs to Z+,i.e {0,1,2,3....}

- dutta.dipankar08 February 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

First ugly no is 1 when i=j=k=0; i,j,k belongs to Z+,i.e {0,1,2,3....}

- dutta.dipankar08 February 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

n-th ugly number is when i=j=k=n?
Is it?

- Anonymous February 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

a sequence of ugly numbers are :
<1,2,3,4,5,6,8,9,10,12,15,16,18,20........>

Note that all number are in the form of 2^i * 3^j * 5 ^k , i.e has only the factor : 2 or 3 or 5. For example 13 is not an Ugly number. 21 is also not an Ugly number as it can't be expressed as 2^i * 3^j * 5 ^k [ 7 is a factor ] . The ugly number are in increasing order, whre 1st elemnt is 1, second element is 2, 10-th element is 12. Find out n-th Ugly number ?

- dutta.dipankar08 February 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use DP.

void foo(int n)
{
        static int ind2,ind3,ind5;
        static int arr[30],depth;
        int num2,num3,num5,num,flag=0;
        if(n<=0) return;
        if(depth==0)
        {
                ind2=ind3=ind5=0;// i know this is redundant
                arr[depth++]=1;
        }
        num2=arr[ind2]*2;
        num3=arr[ind3]*3;
        num5=arr[ind5]*5;
 
        num=min(num2,min(num3,num5));
 
        if(num==num2)
        {
                ind2++;
                if(arr[depth-1]!=num2)
                {
                        flag=1;
                        printf("%d\n",arr[depth-1]);
                        arr[depth++]=num2;
                }
        }
        else if(num==num3)
        {
                ind3++;
                if(arr[depth-1]!=num3)
                {
                        flag=1;
                        printf("%d\n",arr[depth-1]);
                        arr[depth++]=num3;
                }
        }
        else
        {
                ind5++;
                if(arr[depth-1]!=num5)
                {
                        flag=1;
                        printf("%d\n",arr[depth-1]);
                        arr[depth++]=num5;
                }
        }
        if(flag)
                foo(n-1);
        else
                foo(n);
        
}

Complete working code: ideone.com/qz4Py

It prints first n ugly numbers.

- Aashish July 24, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- aoe February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

What is the first ugly num?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

All even numbers are included in the list, only for odd numbers we can check whether it is divisible by 3 or 5 and included it. Is there any better approach?

- Anonymous February 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not all even numbers can be included,,,for example 14,,, 2^1 X 7^1

- Anonymous October 09, 2012 | Flag


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