## Adobe Interview Questions

- 0of 0 votes
Given a list L of numbers from 0 to n, and another number k = [0-9], find how many times k appears in L. If the target number in L is more than one digit, treat each digit separately. For example, k=0 appears twice in L = [0,10].

- 0of 0 votes
Given 2 numbers (where 6 can also be written as 5, and 5 as 6), calculate the maximum and minimum possible sum

Ex :

456 485

Min 455 + 485

Max 466 + 486

- 0of 0 votes
Find out the number of ways in which two queens can be placed in a 8*8 chessboard.

- 0of 0 votes
Find the possible (x,y) coordinates in a given 2-D chess board which are safe from the attack of a queen.

- 0of 0 votes
You are a string conscious guy. You categorise strings into 3 types: good, bad, mixed. If a string has 3 consecutive vowels or 5 consecutive consonants or both, it is bad. Else it is good. If a string has ‘?’, that can be replaced with any character. Thus, string ‘?aa’ can be bad if ‘?’ is vowel or good if consonant. Thus, it is mixed. Implement function which takes string s as input and returns good, bad or mixed

- 0of 0 votes
You are a musician who plays different songs at different volumes. You have a particular difference that needs to be present for new song, but you don't care if it is more or less. You are given initial volume l, array of volume changes where arr[i] is volume change required after i-th song, max_vol h (min vol always 0), array size n. You need to find the max possible volume for the last song. But if at any point change is not possible, return -1. Format: n, arr[n], l, h. Ex: 3, 1 1 1, 0, 5. Ans: 3. Ex: 4, 9 1 5 4, 8, 15. Ans: -1. Ex: 3, 5 3 7, 5, 10. Ans: 10.

Input explanation :

First number = size of array,

then next ‘n’ numbers of array.

Then ‘l’ means initial volume

Then ‘h’ means max volume.

Eg. 3, 1 1 1, 0, 5 means n = 3, arr = {1,1,1}, l = 0, h = 5,

Output explanation: initially you play music at vol 0, then for first arr element. Arr[0] inc. by 1,

Arr[1] inc. by 1, arr[2] inc by 1 total = 3

- 2of 2 votes
Given infinite supply of coins of denominations 25, 10, 5 and 1, find the distinct number of ways to use the coins to sum up to the given value

- 0of 0 votes
Given an array of integers where size of array can be large. Find if it is possible to make all elements of given array equal by multiplying elements with one or more input prime numbers.

e.g.

arr = 50, 200

primes to use = 2, 3

so possible by multiplying 50 by 2 * 2

e.g.

arr = 3, 5

primes to use = 7

not possible

- 0of 0 votes
I was asked this question:

Imagine you want to build a standalone app. This app let's user see the N nearest ATMs within the range. You can assume that the app will show ATMs within some range(like 1km * 1km square). You have baked-in the offline map of the city in the app itself - which means the app already know the locations of all the ATMs in the city. Assume that ATMs and your location to be 2d cordinates(x, y). Also you have stored the location of all the ATMs in the app itself. You need to find the best and most efficient way to find the nearest ATMs within the range.

You don't have to give the logic to find the distance between two points. You need to tell how can you filter out soo many ATMs within the city for a given range. You can assume that the region for which you want to show the location of the ATMs be a square/rectangle. The app knows your location everytime.

So basically the problem is - how will you store those ATMs coordinates in the app so that the app at any point can filter out N ATMs for you if they lie inside the region.

My solution was to have sorted x coordinates and sorted y coordinates pre computed. Now in the sorted x coordinates, Find all the x coordinates that lie within the range of the region's x coordinates for which you want to find the ATMs. Repeat the same for y coordinates. Now find the intersection of both the result. This will give you the result. But interviewer wanted more optimized approach. Any idea how to do better?

- -1of 1 vote
Consider a string, s = "abc". An alphabetically-ordered sequence of substrings of s would be {"a", "ab", "abc", "b", "bc", "c"}. If we reduce this sequence to only those substrings that start with a vowel and end with a consonant, we're left with {"ab", "abc"}. The alphabetically first element in this reduced list is "ab", and the alphabetically last element is "abc". As a reminder:

Vowels: a, e, i, o, and u.

Consonants: b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, and z.

Complete the findSubstrings function in your editor. It has 1 parameter: a string, s, consisting of lowercase English letters (a − z). The function must find the substrings of s that start with a vowel and end with a consonant, then print the alphabetically first and alphabetically last of these substrings.

Input Format

The locked stub code in your editor reads a single string, s, from stdin and passes it to your function.

Constraints

3 ≤ length of s ≤ 5 × 105

Output Format

Your function must print two lines of output denoting the alphabetically first and last substrings of s that start with a vowel and end with a consonant. Print the alphabetically first qualifying substring on the first line, and the alphabetically last qualifying substring on the second line.

Sample Input 1

aba

Sample Output 1

ab

ab

Explanation 1

"ab" is the only possible substring which starts with a vowel (a) and ends with a consonant (b). Because we only have 1 qualifying substring, "ab" is both the alphabetically first and last qualifying substring and we print it as our first and second lines of output.

Sample Input 2

aab

Sample Output 2

aab

ab

Explanation 2

There are 2 possible substrings which start with a vowel and end with a consonant: "aab" and "ab". When ordered alphabetically, "aab" comes before "ab". This means that we print "aab" (the alphabetically first qualifying substring) as our first line of output, and we print "ab" (the alphabetically last qualifying substring) as our second line of output.

Sample Input 3

rejhiuecumovsutyrulqaeuouiecodjlmjeaummaoqkexylwaaopnfvlbiiiidyckzfhe

Sample Output 3

aaop

utyrulqaeuouiecodjlmjeaummaoqkexylwaaopnfvlbiiiidyckzfh

Explanation 3

There are 4830 substrings of s, but only 676 of them start with a vowel and end with a consonant. When ordered alphabetically, the first substring is "aaop" and the last substring is "utyrulqaeuouiecodjlmjeaummaoqkexylwaaopnfvlbiiiidyckzfh".

- 1of 1 vote
Given a binary tree, whose leaf nodes are connected,

1

/ \

2 3

/ \ /

4 5 6

Now 4,5,6 are leaf nodes in the above BT, 4->5->6

4's left is pointing to 6 and 6's right is pointing to 4. We have a circular DLL of leaf nodes.

We need to find the height of this tree?

- -1of 1 vote
Input: set of coordinates = [P1,P2,...,Pi,.....Pj,....Pn]

P denote Point(x,y)

Start point is any of set of coordinates like Pi

simily end point is also any of set of coordinates like Pj.

Find the shortest path with set of points between start and end points.

Let us have a simple example

Set of coordinates :

P4 P5 P6

P1 P2 P3 P7 P8 P9 P11 P12 P13

P10

Start Point: P2

End Points: p12

Output: P2,P3, P7,P8,P9,P11,P12

- -4of 4 votes
Did anyone from Bangalore attend Adobe's interview ?

Interviews were supposed to be organized in Bangalore on 23rd and 24th April 2016. Anyone ?

- 1of 1 vote
which number most unlikely belong to following set of number 9 23 46 75 116

- 0of 0 votes
Write test cases for siri mobileapp?or give me test cases for siri app9mobile)

- 0of 0 votes
ATM has x currency notes of 100 rupee,y currency notes of 500 rupee,and z currency notes of 1000 rupee notes.

Customer wants to withdraw n amount at any given time. as per bank rules,Customer can not withdraw more than INR.40000/-per transaction.

If ATM is running out of cash it should throw a message that insufficient Balance, Kindly enter multiple of m value of currency note.where m>=4000 and m<=total number of cash available in ATM.

An intelligent banker has found in customer survey that customer prefers to receive more than 5 currency notes 100 rupee,more than 2 currency noes of 500 rupee and rest of the currency notes is of 1000 rupee where ever possible.

If amount is less than 500,customer will receive 100 rupee currency notes. Bankers goal is to tender the minimum number of currency notes to save customer waiting time and increase customer satisfaction by following customer survey.Banker has hired you to program ATM dissaptch function.

FOR Example: Lets ATM has 200 currency notes of 100 rupees,90 currency notes of 500 rupee and 50 currency notes of 1000 rupee.Customer has placed a withdrawal request of Rs 22,200.00. Dispatch function has given him 7 currency notes of 100,3 currency notes of 500 and 20 currency notes of 1000 rupee

- 1of 1 vote
Given-an-array-of-length-n-having-integers-0-to-n-1-in-unsorted-order-we-have-to-modify-this-array-such-that-the-value-at-a-n-becomes-a-a-n-for-example-if-a-0-contains-5-then-a-0-will-have-value-a-5-and-so-on-condition-is-that-this-should-take-O-n-time-complexity

- -1of 1 vote
https://www.quora.com/Given-an-array-of-length-n-having-integers-0-to-n-1-in-unsorted-order-we-have-to-modify-this-array-such-that-the-value-at-a-n-becomes-a-a-n-for-example-if-a-0-contains-5-then-a-0-will-have-value-a-5-and-so-on-condition-is-that-this-should-take-O-n-time-complexity

- 0of 0 votes
A company is trying to find best possible optimal solution for servicing his customer base of 300 with 12 employee.

They want a technology solution that tells how they will be able to meet customer requirement as business will grow and other changes like location of customer changes, new locations added and so on.

Problem is basically a form of Travelling Salesman Problem ( TSP ) or Vehicle Routing problem ( VSP ). Following things need to be completed here.

1> Explain logistics involved in this problem into succinct business definition.

2> Different approach with which problem can be solved

3> One implementation of the problem ( proof of concept ), using customer base coordinates mentioned below. ( 0,0 ) is considered the company coordinate which is the starting point. ( preferably Java )

Here are coordinates with which working solution is expected provided in a text file as input:

X coordinate Y Coordinate

420 278

421 40

29 178

350 47

298 201

417 186

378 134

447 239

42 114

45 199

362 195

381 243

429 1

338 209

176 9

364 26

326 182

500 129

190 51

489 103

368 142

132 260

305 200

446 137

375 154

440 190

9 118

437 32

383 266

282 51

366 19

465 173

93 210

257 185

316 242

315 141

236 14

352 155

311 106

300 261

66 154

172 245

376 16

152 283

41 259

278 158

299 102

81 178

178 218

344 150

269 172

379 710

301 611

287 295

392 258

259 333

427 273

411 233

355 707

439 717

298 390

338 547

407 697

287 220

355 524

365 228

257 632

294 395

315 626

275 268

346 724

324 230

436 310

279 240

317 601

274 661

294 483

350 234

328 689

656 765

778 792

724 797

686 723

784 785

730 756

775 731

777 647

881 498

634 906

588 709

884 867

837 670

513 477

414 794

387 798

430 587

638 18

26 497

721 765

595 706

985 962

619 125

106 252

198 104

554 91

11 875

757 386

378 253

719 878

561 969

36 821

179 442

31 814

710 103

8 168

401 304

913 921

983 250

100 727

0 425

114 900

337 977

709 808

107 435

442 488

68 42

826 967

771 399

460 831

520 83

530 406

727 406

58 195

732 240

512 974

438 366

184 954

423 905

549 923

433 292

395 237

764 73

698 503

146 536

200 211

48 38

31 39

60 37

41 38

71 37

54 39

23 35

73 38

67 33

45 39

47 34

69 30

39 34

52 38

28 30

949 892

959 909

966 930

993 923

925 887

946 888

998 951

931 894

966 839

959 812

986 965

946 979

927 800

979 803

987 980

983 975

993 858

936 851

998 912

993 939

997 916

1000 832

975 898

919 882

916 883

980 974

975 902

996 808

999 864

991 829

995 985

982 926

13 690

23 525

10 864

15 283

2 149

3 580

8 299

16 361

- 0of 0 votes
c program using single linked list.

Assume m nodes means 100 or 200 but we dont know exact.

print element m-4 node.

Example: if m is 100 node print 96 node data

- 0of 0 votes
C program to accept two strings and print characters which are not present in first string.

Example: 1 string: apple

2 string: aeroplane

output: ro

- 1of 1 vote
There are 10 coin producing machines which produces a coin of weight x grams. Out of those, 2 machines are defective and produces coins of x-1 grams. How to find those two defective machines.

Then extend this question to a total of n machines and out of those m machines are defective.

- 2of 2 votes
Given an array of positive integers(>0) , you have to insert '+','*','(',')' signs basically plus multiply and brackets such that value of resultant expression becomes maximum.

Hint: Consider case of continuous ones

You have to print the resulting expression

- 0of 0 votes
You are given a vector of strings. They have some encoded information regarding location of a hostage. You know that each location in encoded message starts with _123 and ends with _dad. You have to find all such unique enocded locations in the text.

I want to use regex to find the solution to this problem in C++. Can someone provide code for the same.

- 0of 0 votes
The King's Land Sale - 2

You might have seen shopkeepers offering sale on their trade items to promote their business - like sale on electronic gadgets or sale on clothing and accessories etc. But have you ever come across something like sale of land ?

Yes, the king of Byteland has grown old and wants to sell away his territory as soon as possible. So he announced a sale on his plot. This drew attention of many land lords and everybody hurried to buy land at the cheapest prices. The king had declared that he would accept bids of only rectangular plots and one needs to mention the diagonally opposite corners(a, b) and (c, d) of the land he wishes to buy. They would write these 4 numbers (a, b, c, d) on a piece of paper, seal it in an airtight envelope and give it to the king.

The king received N such envelopes. As the process was hidden there were many envelopes containing plot descriptions that shared some (or even all) common area. The king now wants to know the union of the areas of all plots that have come under the bidding.

Note that the rectangles made by the plots are always aligned to the rectangular axes, their areas is always positive and c >= a and d >= b.

Note that the rectangles made by the plots are always aligned to the rectangular axes, their areas is always positive and c >= a and d >= b.

Constraints

1 ≤ T ≤ 20

1 ≤ N ≤ 20

-10000 ≤ a, b, c, d ≤ 10000

Input

The first line of the input contains the number of test cases T. The description of T test cases follow. Each test case starts with a line containing an integer N, the number of rectangular plots. Then N lines follow, each with 4 space separated integers, a b c d,(a, b) and (c, d) representing the diagonally opposite corners of the plots.

Output

For each test case print one line, the union of the areas of all the plots.

Explanation

1) The individual areas of both plots are 4 each. But they share a common area of 1 between them (between (1, 1) and (2, 2)). Therefore the total area is 4 + 4 - 1 = 7

2)Both the plots of no area in common. So we simply add their individual areas (6 + 9 = 15).

- 2of 2 votes
Given an array A with n integers.

Rearrange array such that

A[0]<=A[1]>=A[2]<=A[3]>=A[4]<=A[5] and so on

Edit: Array is not sorted

You have to do it in linear time O(N)

- 0of 0 votes
Samu's Birthday is near so she had started planning a party for all of her friends. Being a kind and caring girl she calls each of her friend and asks for his/her favorite dish.Now each friend has own liking/disliking for different dishes.

A friend can only like or dislike a dish it means if we are having three dishes 1,2,3 then if a friend says that he likes Dishes 1 and 2 then its obvious that he dislikes Dish 3. So for each friend we are given a string of 1 and 0 where 1 shows that this person like this particular dish.

Now we are given that Samu has N friends and total of K dishes available to make her menu. Now Samu doesn't want to make any of her friend unhappy , After all its her birthday.

So she got confused on what dishes to count in menu and calls you for help. You need to find count of minimum dishes to order so that all of her N friends are happy which means everyone has at least one dish to eat in party.

Note : Its for sure that everyone has at least liking for one dish.

Input : Input will contain T test cases and each of the test case has following description :

First line of test case has N denoting the total number of friends and K denoting the total number of dishes available.Both separated by a space (Dishes are numbered from 1 to K) .

Then it is followed by N lines each of length K . Each of the N lines contains a string of 0 and 1 where if jth (1<=j<=K) value in ith line (1<=i<=N) is set 1 then it shows that dish

- 0of 0 votes
how 4gb process can run on 2 gb ram ?

Follow up,

why we use 8 gb ram if we can manage with 2 gb ram ?

Please suggest answer ?

- 0of 0 votes
This is a sample program to find the maximum contiguous sum in an array.

`int maxSubArraySum(int a[], int size) { int max_so_far = a[0], i; int curr_max = a[0]; for (i = 1; i < size; i++) { curr_max = max(a[i], curr_max+a[i]); max_so_far = max(max_so_far, curr_max); } return max_so_far; }`

Now modify this to print the start and end indices.

- 0of 0 votes
Given a list a1,a2,a3….an. Comparison between elements is given like a1>a2, a3>a5, a4>a2…..etc. Find whether there are any situations that we can sort the list in to the ascending order on the basis of comparison. Yes or No , explain the conditions