## Adobe Interview Question for Interns

• 0

Country: India
Interview Type: Written Test

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

is it like each element must be rounded to the next power or the sum of all elements? I assume each element:

``````unsigned long long memory_required(const vector<unsigned int>& elements) {
unsigned long long total = 0;
for(auto e : elements) {
unsigned long long mask = 1 << 31;
else total += mask << 1;
}
}``````

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

``````public static int roundOff(int[] arr)
{
int number = getSum(arr);

return nextHighestPower(number);
}

private static int nextHighestPower(int number)
{
if ((number & number - 1) == 0)
{
return number;
}
else
{
int count = 0;
while (number != 0)
{
number = number >> 1;
count++;
}
return 1 << count;
}
}

public static int getSum(int[] arr)
{
int sum =0;

foreach (int i in arr)
{
sum +=i;
}
return sum;
}``````

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

Can we use python? If so...

``````def required_memory(lst):
used = sum(lst)
if used % 4 != 0:
return used // 4 + 1
return used // 4``````

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

Is there a reason that you can't just use python and say

``````def memory_required(lst):
used = sum(lst)
return used // 4 + 1 if used % 4 else used // 4``````

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

``test comment``

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

``````function getMaxMemory(arr) {
let cr = 2, final = 2;
arr.forEach((element, ind) => {
if (element > cr) {
cr = (((final * 2) - final) + cr) - element;
final *= 2;
} else {
cr -= element;
}
});
return final;
}

console.log(getMaxMemory([2, 1, 5, 6, 4]));``````

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

``````function getMaxMemory(arr) {
let cr = 2, final = 2;
arr.forEach((element, ind) => {
if (element > cr) {
cr = (((final * 2) - final) + cr) - element;
final *= 2;
} else {
cr -= element;
}
});
return final;
}

console.log(getMaxMemory([2, 1, 5, 6, 4]));``````

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.

### 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.