## Senior Software Development Engineer Interview Questions

- 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

- 0of 0 votes
Given a Matrix A,

The rules for movement are as follows :

1. Can only move Right or Down from any element

2. Can only move within the row and column of element we start from intially.

3. You can only visit or cross an element if its value is lesser than the value of element you start from.

Find total number of elements one can visit, If one starts from an element A(i,j) where i-> row and j-> column.

Note : You have to print this output for each matrix element.

Input : Matrix

1 2 3

2 3 1

3 1 2

Output:

1 1 3

1 3 1

3 1 1

- 0of 0 votes
Find the label with max width of a tree.

// 0 A

// /|\

// 1 B C D

// /| | \

// 2 E F G H

Answer is 2 here.

- 0of 0 votes
You are given an array of values, (not necessary integers or positives) and a value. You have to print all the pairs whose sum is given value. Write a general method which can accept integers, float, doubles, long, or any other thing where this make sense.

- 0of 0 votes
1) write a concurrent singleton class.

2) Write a factory method class, and how it is used

3) Define a sealed class.

4) What if we want to replace sealed class with another class and use this new class where ever we have used our sealed class, how do you do that.

5) What would you look in a code review?

6) Do you know about adapters, bridges design pattern

7) Define async await method, how do we read data in task library

8) What are the other methods of making your call multi-threaded

9) Do you know Linq queries

10) How to make defer/no defer execution in Linq Queries.

11) Where do you use singleton class, give at least three examples

12) When we use singleton class and when static, both have the single instance.

- 2of 2 votes
Given the following set of strings, write a function that stores this information.

// /Electronics/Computers/Graphics Cards

// /Electronics/Computers/Graphics Cards

// /Electronics/Computers/SSDs

// /Electronics/Computers/Graphics Cards

// /Electronics/Computers/SSDs

// /Electronics/TVs

// /Electronics/Computers/Graphics Cards

// /Electronics/TVs

// /Electronics/TVs

// /Garden

// /Automotive/Parts

Your datastructure should be able to provide information as such:

// / = 11

// /Electronics = 9

// /Electronics/Computers = 6

// /Electronics/Computers/Graphics Cards = 4

// /Electronics/TVs = 3

// etc

// ["/Electronics/Computers/Graphics Cards", "/Garden"]

- 0of 0 votes
Consider 10 years down the line we have a mobile device which have 10 TB hard disk.Consider the device a file of 5TB and RAM on the device is 1GB. How will you sort the file of 5TB. You can use extra space but RAM is 1GB which is used by other application on the device also.

- 0of 0 votes
Write a Program in Java, You have an Employee class |

class Employee{

String name;

Integer id,

Employee manager

}

Each employee has a manager and the manager of CEO is null. Find all direct and indirect reportees of a manager.

Eg. Say Employee e1 reports to CEO,

e2 and e3 reports to e1,

e4 and e5 reports to e2,

e6 reports to e3.

Then by giving e1 as input, output should be e2, e3, e4, e5 and e6.

- 0of 0 votes
/**

* A tournament tree is a binary tree

* where the parent is the minimum of the two children.

* Given a tournament tree find the second minimum value in the tree.

* A node in the tree will always have 2 or 0 children.

* Also all leaves will have distinct and unique values.

* 2

* / \

* 2 3

* / \ | \

* 4 2 5 3

*

* In this given tree the answer is 3.

*/`class Node { Integer value; Node left, right; Node(Integer value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } } class Solution { /** * This should return the second minimum * int value in the given tournament tree */ public static Integer secondMin(Node root) { } }`

- 0of 0 votes
Given a number n that represents n lockers and n students. All lockers start closed. First student goes and opens all the lockers. Second goes and toggles 2nd, 4th, 6th.. lockers. Third student toggles 3rd, 6th, 9th.. lockers. Print the lockers that remain open after all students pass.

`public void lockers(int n) { // Implementation here }`

- 0of 0 votes
Given 3 sorted arrays. Find(x,y,z), (where x is from 1st array, y is from 2nd array, and z is from 3rd array), such that x<y<z.

x = element(s) from array 1

y= element(s) from array 2

z = element(s) from array 3

I can have more than 1 elements from each array. But at least 1 from each array is mandatory and elements from .`int[] arr1 = {3}; int[] arr2 = {11, 13, 16}; int[] arr3 = {45}; Correct Output : 7 (3,11,45) (3,13,45) (3,13,16,45) (3,16,45) (3,11,13,45) (3,11,16,45) (3,11,13,16,45)`

Need to find the number of such sequences.