## Software Engineer / Developer Interview Questions

- 0of 0 votes
Write a function that takes a list of positive integers as an input, and returns all of the pairs of integers it contains that sum to 100. You can assume that all inputs are between 1 and 99.

- 0of 0 votes
This test was on https://www.hackerrank.com

Input is a string of Bytes E.g.341B

Convert it to human readable form: 3 characters long (excluding decimal)

No trailing or leading zeros

E.g:

Input 341B

Output 341B

Input 12345B

Output 12.3K

Input 1234567B

Output 1.23M

Input 1000000000B

Output 1G

Do not round off

Assume input will not be more than 1G

For this problem 1000B = 1K, so on and so forth

- 0of 0 votes
We are given a specific time(like 02:23), we need to get the angle between hour and minute(less than 180)

- -1of 1 vote
Given an array of numbers print the values in diagonal format.

Example (1) for 8 dataset

Input Array : [1, 2, 3,4,5,6,7,8]

Output

01 02 04 07

03 05 08

06

Example (2) for 45 dataset

Input Array: [1, 2, 3,4,5,6,7,8,9,10……….44, 45]

Output

01 02 04 07 11 15 19 23 27 31 35 39

03 05 08 12 16 20 24 28 32 36 40 43

06 09 13 17 21 25 29 33 37 41 44

10 14 18 22 26 30 34 38 42 45

Code in Java.

- 0of 0 votes
Given number of digits of a phone number and number of disallowed digits as input, find all permutations of numbers which do not have two adjacent numbers the same, i.e. 1232 is allowed but not 1223. Disallowed digits can be upto 3, and can be included along with the phone number. Also the phone number should start with 4 if it contains the number 4.

- 0of 0 votes
The decimal and octal values of some numbers are both palindromes sometimes. Find such numbers within a given range.

- 0of 0 votes
If one and a half teenagers, eat one and a half pizzas in one and a half days, how many pizzas can 9 teenagers eat in 3 days

- 0of 0 votes
Suppose I am given a set of input strings input[5](five of them) and their corresponding replacement strings replace[5]. Then I am given an input text, how can I replace the strings in the text matching any of the inputs with their corresponding replacements.

Also I have to make sure that if suppose, I find a match input[0] and I replace it by replace[0], then because of that it could be possible that I have a new match for input[2] lets say because of the new characters added by replace[0]. I don't want to make replacements with replace[2].

- 0of 0 votes
Suppose I have five strings input[5] and their corresponding replacements replace[5]. I am given an input text and I want to find the occurence of any of the input strings and replace them with the corresponding replace strings. I cannot use regex. How can I do it. Also I have to make sure that lets say after replace input[0] with replace[0], if a new string arises due to replace[0] that matches with lest say input[2], then I cannot replace it with replace[2].

- 0of 0 votes
Goldbach's conjecture : Every even integer greater than 2 can be expressed as the sum of two primes.

Write a function which takes a number as input, verify if is an even number greater than 2 and also print atleast one pair of prime numbers.

- 2of 2 votes
The stepping number:

A number is called as a stepping number if the adjacent digits are having a difference of 1. For eg. 8,343,545 are stepping numbers. While 890, 098 are not. The difference between a ‘9’ and ‘0’ should not be considered as 1.

Given start number(s) and an end number(e) your function should list out all the stepping numbers in the range including both the numbers s & e.

- 0of 0 votes
I was having an interview and here is the question:

If there are different pairs of characters, each pair of the characters means the two matching characters are the same. Print out all the identical characters.

For example:

if you have pairs:

A-B

C-D

E-F

G-H

A-D

F-G

you should print out:

{A, B, C, D} are the same characters.

{E, F, G, H} are the same characters.

Does anyone know how to solve this problem by not using brutal force?

- 1of 1 vote
Given a NXN matrix, starting from the upper left corner of the matrix start printing values in a counter-clockwise fashion.

Eg: Consider N = 4

Matrix= {a, b, c, d,

e, f, g, h,

i, j, k, l,

m, n, o, p}

Your function should output: dcbaeimnoplhgfjk

Another example would be

C I P E

R N K U

U O W O

L E S Y

The function should print: EPICRULESYOUKNOW

- 0of 0 votes
Implement bool isPalindrome(SingleLinkList *node) in constant Space.

Sorry for incomplete post earlier..

- 0of 0 votes
Implement bool regex() Function.

- 0of 0 votes
Implement bool isBST(Tree * root)

- 0of 0 votes
Hi,

Anyone here who has given the Amazon work style and personality test for the SDE/SDET position? If someone could shed some light on what exactly it is?

- 0of 0 votes
Hi,

Anyone here who has given the Amazon work style and personality test for the SDE/SDET position? If someone could shed some light on what it is exactly?

- 0of 0 votes
Find all the calendar events which are overlapping.

Suppose there is event A: 10-15 Oct, B : 12-14 Oct , C:15-24 Oct, D: 23-34 Oct, E: 4-5 Oct

All events except E should be marked as overlapping as they overlap with some other event.

- 0of 0 votes
Find all the calender events which are overlapping.

Suppose there is event A: 10-15 Oct, B : 12-14 Oct , C:15-24 Oct, D: 23-34 Oct, E: 4-5 Oct

All events except E should be marked as overlapping as they overlap with some other event.

- 3of 3 votes
You're given an array of integers(eg [3,4,7,1,2,9,8]) Find the index of values that satisfy A+B = C + D, where A,B,C & D are integers values in the array.

Eg: Given [3,4,7,1,2,9,8] array

The following

3+7 = 1+ 9 satisfies A+B=C+D

so print (0,2,3,5)

- 1of 1 vote
A Multi-threaded server application stops working and the last log message from the application is:

`"Some Server Related Message..."`

Code looks like:

`CalledFunc () { Code ... Acquiring Thread lock Line printing "Some Server Related Message..." Func(); Releasing Thread Lock }`

1. What should the programmer in charge do to debug this?

2. What has happened wrong in the Func()?

3. If an exception is thrown in the Func() what should be done to fix problem ?

- 0of 0 votes
A Multi-threaded server application stops working and the last log message from the application is:

`"Some Server Related Message..."`

Code looks like:

`CalledFunc () { Code ... Acquiring Thread lock Line printing "Some Server Related Message..." Func(); Releasing Thread Lock }`

1. What should the programmer in charge do to debug this?

2. What has happened wrong in the Func() ?

3. If an exception is thrown in the Func() what should be done to fix problem ?

- 0of 0 votes
compare the time complexity of quick ,merge and bubble sort

- -1of 1 vote
`public abstract class Session{ private Object objectId; //... other fields public abstract void processRequest(InputStream in); } public XmlSession implements Session{ public void processRequest(InputStream in){ System.out.println("XML RESPONSE"); // DO STUFF TO XML RESPONSE } } public JSonSession implements Session{ public void processRequest(InputStream in){ System.out.println("JSON RESPONSE"); // DO STUFF TO JSON RESPONSE } } public static void main(String args[]){ Session session = new XmlSession(); session.processRequest(); Session session = ....; session.processRequest(); }`

I would like to change my design in a way that I will not lose the Session object and I don't change the client code that instanciate the XmlSession.

Could it be useful the prototype pattern? If yes why?

- 0of 0 votes
Given two classes C1 and C2 which are almost same.(remember not exactly same).

You want to choose best among these classes so that it can be use as key in hashmap.

What question will you ask regarding two classes C1 and C2.

- 0of 0 votes
Given a binary tree and a range as min and max.

Modify the tree such that number formed by traversing tree from root to leaf all fall in given range.

1

2 3

4 5 6 7

let say range is 125 - 136

Modified tree

1

2 3

null 5 6 null

- 3of 3 votes
Given a sorted array. Now following operations may be applied on even position elements:

swap elements on even position. An element may be swap only once.

eg. 1 2 3 4 5 6 7 8 9 10

modified array:

1 2 3 8 5 10 7 4 9 6.

Find any given element in less than o(n) complexity.

- 0of 0 votes
write a program to find the minimum value in an unsorted array of integers. how many assignment operations happen within the loop?

- 0of 0 votes
what does this code do?

`unsigned mystery(unsigned x) { unsigned i=0; while(x) { x=x&(x-1); i++; } return i; }`