## Senior Software Development Engineer Interview Questions

- 0of 0 votes
You need to design a new YouTube feature where userA is uploading a video and userB (friend of userA) gets notified for the video and wants to watch the same video in real time (i.e. even the video is not completely uploaded but we want to enable the other user to watch it).

How would you tackle the situation when userB wants to view the content starting from a position which is not yet uploaded.

Draw block diagram for this problem identifying the different components.

- 0of 0 votes
Given two positive integers represented as linked lists, provide the sum of the numbers as a linked list.

`1->2->3 4->5->6 ----------- 5->7->9 1->2->3 4->5 ----------- 1->6->8 4->5->6 7->8->9 ----------- 1->2->4->5`

- 0of 0 votes
A and B are playing a perfect 8-9 game. The rules are pretty simple. At each point, you can either insert an 8 at the end of the previous number or a 9. one 8 and one 9 forms a pair. a 9 can only be inserted if there is an 8 which does not form a pair. Perfect solution is the one which has all its numbers in pair. Find out all the possible perfect outcomes of the game in lexicographic order.

Input-

Input 1: Max length of number

Output-

Your array must return an array of string s containing all possible outcomes.

Example 1:

Input: 4

Output: {"8899", "8989"}

Explanation: There can be only 2 possible outcomes out of 4 as nine must follow eight.

Example 2:

Input: 6

Output:{"888999","889899","889989","898899","898989"}

Explanation: The possible outcomes are 5.

- 0of 0 votes
/**

*

* Google OnSite Round 3

*

* Data structure for Task Dependency

* A task can start only after all its pre-requisites are done

*

* Code the methods addTask(preRequisiteTask, dependentTask)

* and

* getExecutionSequence()

*

*/

- 0of 0 votes
/**

*

* Google OnSite Round 2

*

* Input is an integer array A

* Return an array B such that B[i] = product of all elements of A except A[i]

*

*/

- 0of 0 votes
/**

*

* Google Telephonic Round 2

*

* Given any uppercase string. Report the starting index at which any valid permutation of

* ABCDEF starts. If not found, then report -1.

* Possible permutations of ABCDEF are ABCDFE, BCDAFE, FEDCAB etc (a total of 6! = 720 permutations)

*

*/

- 0of 0 votes
/**

*

* Google Telephonic Round 3

* Find the sum of all nodes stored in a tree

*

*/

- 0of 0 votes
/**

*

* Google Telephonic Round 3

*

* Convert an integer to base-3 equivalent

*

*/

- 0of 0 votes
/**

*

* Google Telephonic Round 1

*

* Given two strings - S1 and S2.

* Arrange the characters of S1 in same alphabetical order as the characters of S2.

* If a character of S1 is not present in S2 - such characters should come at the end of

* the result string, but make sure to retain the order of such characters

* Case sensitivity is irrelevant

* e.g. S1 = "Google", S2 = "dog"

* Output = "ooggle"

*

* e.g. S1 = "abcdedadf", S2 = "cae"

* Output = "caaebdddf"

*

*/

- 0of 0 votes
Find valid bracket from provided string. Only { [ ( are involved as brackets. A valid bracket contains with a enclose companion.

Example: {} is valid, [[] Invalid

Input: {[()]}[]() Result: Valid

Input: {}[]()( Result: Invalid

- 0of 0 votes
Given a List determine if contiguous elements of the List sum to an input number. For example: Array/List [6 5 3 2 1 7], and input number 8. The numbers 5 + 3 = 8. Or suppose an input number 10, the elements of the list 2 + 1 + 7 = 10.

- 0of 0 votes
Question:

* Implement a program which receives tasks, which are basically objects with "run()" method and

* a long field, where long field indicates the time after which the task should start running

* by calling the run() method

EdgeCases:

* Imagine a case, where (A,10) task A is scheduled to run after 10 seconds

* and then when at 3rd second, another task B comes where (B,2) seconds

* then which one would be executed first ?

- 0of 0 votes
A special number is defined as a number where, in binary notation,

a. has only set bits (OR)

b. all set bits are followed by unset bits (OR)

c. the sequence formed by count of the number of set bits separated by any number of unset bits is a contiguous subsequence of the sequence of natural numbers.

2, 3, 11271 and 15667135 are special numbers because their binary represenation is 10, 11, 10110000000111 and 111011110000111110111111 respectively.

2 is a special number because of condition (b).

3 is a special number because of condition (a).

11271 is a special number because its binary representation is 10110000000111 because of condition (c). The sequence of the count of number of set bits separated by a unset bits is 1, 2 and 3. This is clearly a continguous subsequence of the natural numbers.

Similarly, 15667135 is a special number. (The sequence is 3,4, 5 and 6.)

So, given two integers n and m where n <= m, find out the number of special numbers between n and m inclusive.

Input Format:

The first line of input contains an integer T where T is the number of test cases. Then T lines follow containing two space separated integers n and m where n <= m.

Output Format:

For each test case, output, in different lines, a single integer P where P is the number of special numbers between the range specified.

Constraints:

1 <= T <= 1000

1 <= n <= 10^6

1 <= m <= 10^6

n <= m

Sample Input:

4

2 10

11 15

20 30

2 100

Sample Output:

6

4

5

43

- 0of 0 votes
Implement a rate limiter attribute/decoration/annotation on top of an API endpoint. caps to N requests per minute with a rolling window (implement from scratch / test / compiling + working code. Was made to write the code in front of a computer.

- 0of 0 votes
Basic sales tax is applicable at a rate of 10% on all goods, except books, food, and medical products that are exempt. Import duty is an additional sales tax applicable on all imported goods at a rate of 5%, with no exemptions.

When I purchase items I receive a receipt which lists the name of all the items and their price (including tax), finishing with the total cost of the items, and the total amounts of sales taxes paid. The rounding rules for sales tax are that for a tax rate of n%, a shelf price of p contains (np/100 rounded up to the nearest 0.05) amount of sales tax.

Write an application that prints out the receipt details for these shopping baskets.

Input:

1) 1 book at 12.49

2) 1 music CD at 14.99

3) 1 chocolate bar at 0.85

- 2of 2 votes
Write a program to shuffle a deck of card?

- 0of 0 votes
Suppose you have a stock broker events that send events whenever there is an event occurs, like buy, sell etc.

There are apps that needs gets these data from the events application, not all application needs all the functions.

There is broker interface that is a link between the apps and the stock application. How will you design the classes, methods etc.

- 0of 0 votes
Supposed you have a sorted array, that was rotated like [2 4 6 7 8] => [7 8 2 4 6]. How will find an element in the array.

- 0of 0 votes
Consider a social networking site, where in each user has a number of contacts, how will you find the shortest path between 2 users who are not connected.

- 2of 2 votes
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.

For example,

Given [100, 4, 200, 1, 3, 2],

The longest consecutive elements sequence is [1, 2, 3, 4].

Return its length: 4.

Your algorithm should run in O(n) complexity.

- 1of 1 vote
Generate all possible matched parenthesis, given n left parenthesis and right parenthesis needs to be matched.

- 0of 0 votes
Create a data structure that stores integers, let then add, delete. It also should be be able to return the minimum diff value of the current integers.

That is,

min_diff = minimum ( | x_i - x_j | )

Example:

-1,3,4,10,11,11

min_diff = 0

-1,3,4,10,11,14

min_diff = 1

- 0of 0 votes
Implement a function that returns whether a string made of different bracket characters is well formed or not.

For example,

"{({})[]}" is a well formed bracket string

"{[](}" is not a well formed bracket string

Needless to say any single brackets are automatically counted as not well formed

- -6of 6 votes
aa

- 0of 0 votes
A company's organizational structure is represented as

1: 2, 3, 4

In the above employees with id 2, 3 and 4 report to 1

Assume the following hierarchy.

1: 2, 3, 4

3: 5, 6, 7

5: 8, 9, 10

Given an employee Id, return all the employees reporting to him directly or indirectly

- 1of 1 vote
Given string a and string b, find all the occurences of the anagrams of a in b.

- 0of 0 votes
producer consumer problem

- 0of 0 votes
Define a singleton class

- 0of 0 votes
Make 100 HTTP GET requests to http://en.wikipedia.org/wiki/Main_Page and print the following in Java

statistics for the response time to stdout:

• 10th, 50th, 90th, 95th, 99th Percentile

• Mean

• Standard Deviation

Your solution must be parallel. You must make at least N (say 10, but should be configurable)

requests at a time.

Explain design choices, known limitations and edge cases.

What challenges did you face? How would you improve the code if you had more time?

- 0of 0 votes
With times stored in the format "HH:MM:SS", find the number of "interesting" times that can be displayed between two given times S and T (inclusive).

An "interesting" time is one that can be displayed with at most 2 characters.

For example S "15:15:00" and T "15:15:12" would return the count of 1 as the only "interesting" time between S and T (inclusive) is "15:15:11".

Another example, S "22:22:21" and T "22:22:23" would return the count of 3 because of the following times: "22:22:21", "22:22:22", "22:22:23"

Constraints:

S <= T

00 <= HH <= 23

00 <= MM <= 59

00 <= SS <= 59