Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Adobe interview experience Real time questions & tips from candidates to crack your interview

Adobe

1 rounds | 5 Coding
problems

Preparation

Duration: 4 months

Topics: Data Structures, OOPs, DBMS, OS, CN, Project

Tip

Tip 1 : work on communication skills

Tip 2 : Data Structures and Algorithums

Application process

Where: Other

Eligibility: No criteria

Resume tip

Tip 1 : Include al teast two good project

Tip 2 : good to mention your skills

01

Round

Medium

Video Call

Duration50 mins

Interview date13 Oct 2022

Coding problem5

How to Design BookMyShow, Fandango (or similar movie ticketing application)

A movie ticket booking application such as BookMyShow facilitates users to browse through movies and live events, watch trailers, check seat availability and purchase a ticket. Let’s discuss how to design a similar online ticketing system

```
Two strings are said to be a permutation of each other when either of the string's characters can be rearranged so that it becomes identical to the other one.
Example:
str1= "sinrtg"
str2 = "string"
The character of the first string(str1) can be rearranged to form str2 and hence we can say that the given strings are a permutation of each other.
```

Problem approach

bool isAnagram(string s, string t) {

int a[256]={0};

for(int i=0;i {

a[s[i]]++;

}

for(int i=0;i {

a[t[i]]--;

}

for(int i=0;i<256;i++)

if(a[i]!=0)

return false;

return true;

}

```
1. There are no 2 adjacent elements having same value (as mentioned in the constraints).
2. Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.
```

```
Input: 'arr' = [1, 8, 1, 5, 3]
Output: 3
Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.
```

Problem approach

int findPeakElement(vector& nums) {

int max=-2147483648;

int pos=0;

for(int i=0;imax)

{

max=nums[i];

pos=i;

}

}

return pos;

}

```
The diameter of a binary tree is the length of the longest path between any two end nodes in a tree.
The number of edges between two nodes represents the length of the path between them.
```

```
Input: Consider the given binary tree:
```

```
Output: 6
Explanation:
Nodes in the diameter are highlighted. The length of the diameter, i.e., the path length, is 6.
```

Problem approach

int height(TreeNode* root,int *x)

{

int lh=0;

int rh=0;

int ld=0;

int rd=0;

if(root==NULL)

return 0;

ld=height(root->left,&lh);

rd=height(root->right,&rh);

*x=max(lh,rh)+1;

return max(lh+rh+1,max(ld,rd));

}

int diameterOfBinaryTree(TreeNode* root) {

int x=0;

return height(root,&x)-1;

}

Make a fair coin from a biased coin

You are given a function foo() that represents a biased coin. When foo() is called, it returns 0 with 60% probability, and 1 with 40% probability. Write a new function that returns 0 and 1 with a 50% probability each. Your function should use only foo(), no other library method.

Problem approach

We know foo() returns 0 with 60% probability. How can we ensure that 0 and 1 are returned with a 50% probability?

The solution is similar to this post. If we can somehow get two cases with equal probability, then we are done. We call foo() two times. Both calls will return 0 with a 60% probability. So the two pairs (0, 1) and (1, 0) will be generated with equal probability from two calls of foo(). Let us see how.

(0, 1): The probability to get 0 followed by 1 from two calls of foo() = 0.6 * 0.4 = 0.24

(1, 0): The probability to get 1 followed by 0 from two calls of foo() = 0.4 * 0.6 = 0.24

So the two cases appear with equal probability. The idea is to return consider only the above two cases, return 0 in one case, return 1 in other case. For other cases [(0, 0) and (1, 1)], recur until you end up in any of the above two cases.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

What does ROLLBACK do in DBMS?

Start a Discussion

Similar interview experiences

SDE - Intern

1 rounds | 7 problems

Interviewed by Adobe

1175 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Adobe

649 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 2 problems

Interviewed by Adobe

759 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Adobe

558 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - Intern

3 rounds | 6 problems

Interviewed by Amazon

13227 views

4 comments

0 upvotes

SDE - Intern

4 rounds | 7 problems

Interviewed by Microsoft

12230 views

1 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Amazon

8838 views

2 comments

0 upvotes