Adobe Interview Questions – Set 5

My Interview experience with Adobe for MTS2 (~2years exp)

Online Round (Java)

5 coding questions under 90 mins on Hackerrank.

1. There is a list of 20 words. 10 of them are good works, and 10 of them are bad words. Write a regex of not more than 25 characters which would tell if given word is good or bad. Input would only contain one of these 20 words.
Good words: papa, book, home, cars, jolly, sugar, friend, mother, father, bloomiest
Bad words: ache, slow, torn, slum, boom, rival, wrong, cholera, revenge, arrogant

Input: book
Output: Good

Input: boom
Output: bad

Complete code was already written, I just had to modify the regex pattern. I did it using 23 characters(regex = “[mjphf].*|[bcs].*[tksr]” )

2. Write a regex to determine if an IP address is valid or not.
In this question also, the complete code was already written except a function whose parameter was a string denoting IP address and return type was boolean.
boolean isValidIp(String ipAddress) {
// write logic here
}
My solution: return (ipAddress + “.”).matches(“((([01]\\d\\d)|(2[0-4]\\d)|(25[0-5])|(\\d{1,2}))\\.){4}”);

3. Write a code to read text from STDIN. This text is the source code of some application written in Java. Extract and print all the comments present in the code.

4. Given an expression containing only ‘[](){}’ characters, determine if it represents a balanced parenthesis expression.

5. Last question was very very easy, it was something related to adding up two numbers.

Round 1:

1. Discussed each project.
2. Asked to write CRUD APIs for an Organization with multiple departments and multiple employees. Employees will be added/removed to departments. Information of Employees/Departments will be queried.
3. What is the role of WebServer? What is the difference between Web server and Application server?
4. Given an integer N and a long string containing a lot of words separated by space, reverse words in strings in groups of N. Eg. S = “The quick brown fox jumps over the lazy dog”, N = 3, Answer: “brown quick The over jumps fox dog lazy the”. Discussed time-complexity & space-complexity of the solution. Full code required.

Round 2:

1. How HTTPS works in detail.
2. Design a solution for the following problem. What data-structures will be used? What all classes will be required. Discussion on design.
You are given a City. It contains persons. Persons can marry and eventually may even divorce. Married couples can have babies. Persons die. In this scenario, perform following queries:
i. Marry two persons
ii. Birth of new person
iii. Death of person
iv. Divorce between couples.
v. Total count of the population of city
vi. Given two persons, are they related to each other?
3. Given a matrix print it spirally. Code required.

Round 3:

1. Details about the current company, what work we do, what challenges we face, what is our architecture, what were challenging projects I worked upon.
2. Given a BST and 2 numbers Low and High, print elements greater than Low and less than High. Code required.
3. Given an array and an integer, T tell if T is present in an array or not?
I wrote a trivial for loop, iterated through all elements and checked if the number T was present or not. something like this:

for (i = 0; i < n; i++) { 
   if (arr[i] == T) { 
      return true; 
   } 
} 
return false;

Then he asked how many comparisons will this code make? I said N, then he corrected me and said, look closely its 2*N(I didn’t count i < n in for loop condition)
Then he asked me to optimise the number of comparisons.
I rewrote following code,

for (i = n-1; i; i–) {
    if (arr[i] == T) {
       return true; } 
} 
return false;

Then he said, in for loop condition i would still be compared internally, so this solution was rejected as it also uses 2*N comparisons.
Then finally I solved it using N+2 comparisons in the worst case by the following code.

bool contains(int arr[], int n, int T) {
	if (arr[n-1] == T) { // 1st comparison
	    return true;
	}
	int backup = arr[n -1];
	arr[n - 1] = T
	for (int i = 0; ; i++) {
		if (arr[i] == T) { // This would be executed atmost N times
			arr[n - 1] = backup;
			return (i < n - 1); // final comparison.
		}
	}
}

Director Round(telephonic):

1. Write a library to implement connection pool. What data-structures will be used? What are challenges and their solution? How will it handle the load of 1Million requests per second?
2. Given a huge document containing 1 million words, implement string search in this document. Justify Data-structure used. Space-Time complexity. Code not required. I solved using Trie Data-Structure.
3. Then he modified the previous problem, now rather than searching for complete words we also have to implement substring search. I gave a solution using Suffix Trees. He asked about space and time complexity. I gave N^2 time complexity solution and he wanted me to optimise it.
4. Finally a puzzle, There are N people. Everyone has a unique information. Anyone can call anyone. During a call between two people, all information is exchanged between them. What is the minimum number of calls to be made so that everyone has all information?

After this, there was a simple HR round with normal questions like Why Adobe, etc.

Result: Selected. Thanks CrazyForCode!!

Interview experience shared by Atul

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation