Adobe Interview Question for Software Engineer / Developers


Interview Type: Phone Interview




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

@alex: can u please explain the qquestion?

- preeti January 17, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void * createArray(int dimension[], int size)
{
    if(size == 1){
        void * array = malloc( sizeof(int) *dimension[0]);
        return array;
    }
    void * array = (void *)malloc( sizeof(void *) *dimension[0]);
    
    for(int i = 0; i< dimension[0]; i++){
        array[i] = createArray( & dimension[1], size-1);
    }
    return array;
}

- jigs January 25, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

As for the problem of implementing N loops, you can do it in a recursively way.

- uuuouou January 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can you explain?

- alex January 22, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Say we want to print all the numbers with N digits and each digit has a given upperbound, so the number will be A[0]A[1]A[2]...A[N-1] with A[i] <= upperbound[i], then we may do like this:

void printNumber(char num[], int index, int N, int upperbound[])
{
    if(index == N){
        num[index] = '\0';
        puts(num);
        return;
    }

    num[index] = index == 0 ? '1' : '0';
    for(; num[index] - '0' <= upperbound[index]; ++num[index]){
        printNumber(num, index + 1, N, upperbound);
    }
}

- uuuouou January 23, 2014 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

#include <iostream>
#include<vector>
using namespace std;

int main() {
vector<int> v;
int k;
while(cin>>k)
v.push_back(k);
vector<int>::const_iterator cii;
for(cii=v.begin();cii!=v.end();cii++)
cout<<*cii<<" ";
return 0;
}

- Kanu Sahai January 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

If I understand this question correctly, the function is called with N arguments, and the number of arguments is the number of dimensions, and the value of the arguments is the size of each dimension. So ... using C ...

#include <stdarg.h>
int* AllocateArray(int n_args, ...)
{
va_list list;
va_start(list,n_args);

int total = 1;
for (int i = 0; i<=n_args;i++)
total *= va_arg(list,int);

return (int*)malloc(total * sizeof(int));
}

- Anonymous January 15, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

This gives you a 1d array of size=product of the variables. I need an n-dim array. Fr this I need to implement nested loops, where k is a parameter.

- alex January 22, 2014 | 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