Question: Adobe | 6-Months Internship | 22nd October
2
Entering edit mode
Format
  • 2 hours test
  • 16 MCQ + 2 Coding problem + 1 Essay (Describe your best project)
    • 4 MCQ - Linear Algebra
    • 4 MCQ - Probability & Statistics
    • 4 MCQ - CS fundamentals
    • 4 MCQ - Puzzle problems
Test wasn't lengthy at all, much more than enough time for whole.
Puzzle problems were fun to solve even though they were famous puzzles.
Test is exactly same for every on campus! Few campuses whose oncampus happened a month back confirmed the problems!

Questions: 1 - 4 | Linear Algebra


Questions: 5 - 8 | Probability & Statistics


Questions: 9 - 12 | CS fundamentals


Question: 13 - 16 | Puzzle Problems


Question - 17 (Coding)


Question - 18 (Coding)

4
Entering edit mode
Here are my solutions. I have all correct solution, I'll explain few of interesting problems, if you want other answers simply comment.

Coding Problem - Q17

Its a simple dp problem with certain edge cases easy to fall upon. Simply maintain frequency of each character of S1 in S2 online as you iterate through S2 from left to right. Comment if something is not clear in code.
int f[3]; // frequency of each character in s1
long solve(string s1, string s2) {
   for (int i = 0; i < s2.length(); i++) f[2] += (s2[i]==s1[2]?f[1]:0), f[1] += (s2[i]==s1[1]?f[0]:0), f[0] += (s2[i]==s1[0]?1:0);
   return f[2];
} //Yes, code is over rofl

Coding Problem - Q18

Even easier problem, the only irritating part is string parsing in query. We simply check if ith string starts and ends with vowel, if you yes we store 1 in that position else 0. Simply construct prefix on this answer and now you can return sum of ranges in O(1).
int prefix[200002];
vector solve(vector sarray, vector queries) {
   for (int i = 0; i < sarray.size(); i++) {
       bool j1 = false, j2 = false;
       for (int j = 0; j < 5; j++) j1 = (sarray[i][0]==vowel[j]?true:j1), j2 = (sarray[i][0]==vowel[j]?true:j2);
       if (j1 and j2) prefix[i+1] = 1; else prefix[i+1] = 0;
   } vector Sol;
   for (int i = 0; i < sarray.size(); i++) prefix[i+1] += prefix[i];
   for (int i = 0; i < queries.size(); i++) {
     string Left = "", Right = ""; int j = 0;
     while (queries[i][j] != '-') Left += queries[i][j++];
     for (++j; j < queries[i].length(); j++) Right += queries[i][j];
     Sol.push_back(prefix[stoi(Right)] - prefix[stoi(Left)-1]);
   } return Sol;
}

Puzzles

15. Infection Chessboard

Intuitively, keep all diagonals infected initially, it will surely cover whole board. I have a complicated proof of optimality but i guess, intuition is enough.

16. Lying

100th person is surely lying, since if all 100 are lying then 100th is lying too, which means he should be saying truth, which is contradiction.
So this implies, 1st person is saying truth.
Now this implies 99th person is lying, which in turn implies 2nd person is truthful and this chain goes on.

So in conclusion first 50 are saying truth, and last 50 are lying.

13. Light Bulb

So ith bulb will be switched exactly D number of times, where D(i) is number of divisors of i.
Initially all bulbs were off, so if D(i) is odd only then shall this bulb remain on at end.

If N = pa x qb x rc where p,q,r are prime numbers then D(i) is (a+1)(b+1)(c+1). We want D(i) to be odd, so each term has to be odd. This means every exponent a, b, c should be even. This implies N is a square number!

So only bulbs which are square numbers will be on, that is bulb 1, 4, 9, 16, 25,.., 100 will remain on. so squar_root(100) = 10 is number of bulbs that remains on at end of process.

14. Quadratic Equation

ax2 + bx + c

a,b,c belongs to {0,1,...,33}.

If a = 0, then f(2020) cannot be any of 4 options. For a = 1 its possible. For a = 2, even with b=c=0, f(2020) is greater than all 4 options.
=> a = 1.

So now our quadratic is
x2 + bx + c
.
Now we utilize f(40) = 2020.
f(40) = 2020 = 1600 + b * 40 + c
=> 420 = b * 40 + c. [ 0 <= b,c <= 33 ].
Clearly b <= 10, as 11*40 > 420 and c has to be atleast 0.
Now c can be only in {0, 10, 20, 30}. as b * 40 is divisible by 10.
Checking these, we find b = 10, c = 20.
 x2 + 10 x + 20. This is final quadratic.
Now simply, put f(2020) = 4100620.

ADD COMMENTlink 4.3 years ago mod2 870
Entering edit mode
1
Please share answer for math questions
ADD REPLYlink 4.3 years ago
sunil97sah
• 10
Entering edit mode
0
Problem 17, there's a typo.
It should be f[0] += (s2[i]==s1[0]?1:0);
Problems are rather straightforward. Test is exactly the same for every on-campus! Does it really matter :P
ADD REPLYlink 4.3 years ago
vaibhavr
• 370
Entering edit mode
1
yes corrected the typo.
Haha. Yes, its still helpful to know MCQs - cutoffs will be decided by that and some of them are good.
ADD REPLYlink 4.3 years ago
admin
1.6k
Entering edit mode
0
Agreed, MCQ problems are quite good.
ADD REPLYlink 4.3 years ago
vaibhavr
• 370
0
Entering edit mode
anyone has math question answer?
ADD COMMENTlink 4.3 years ago sunil97sah • 10
Entering edit mode
0
Yes. Here you go:-
  • Q5. 37
  • Q6. 666600
  • Q7. P(B) >= P(A)
  • Q8. P1 = P2
ADD REPLYlink 4.3 years ago
mod2
870
0
Entering edit mode
@Admin User-1 how can we access premium post?
ADD COMMENTlink 4.3 years ago sunil97sah • 10
Entering edit mode
0
Presently, only AlgoUniversity students can access it.
You can however, request access to TJO premium by dropping a whatsapp at 9515409221. We do allow access on case-per-case basis.
ADD REPLYlink 4.2 years ago
admin
1.6k
Entering edit mode
0
AlgoUniversity?
ADD REPLYlink 4.2 years ago
sunil97sah
• 10

Login before adding your answer.

Similar Posts
Loading Similar Posts