## .Net/C Interview Questions

- 0of 0 votes

AnswersWrite test cases for earring with diamond, gold clamp, diameter 13mm, width 4mm

- roman.khomitsky19 October 05, 2019 in United States| Report Duplicate | Flag | PURGE

Amazon Testing / Quality Assurance - -1of 1 vote

AnswersGiven a set of horizontal and vertical line segments, find the number of squares formed by them?

- uj.us October 04, 2019 in United States| Report Duplicate | Flag | PURGE

Google Software Engineer - 0of 0 votes

AnswersImplement union and intersection of two array(in a efficient way).

- dhruvjoshi43 October 04, 2019 in india for none

Additional information given by the interviewer was: elements of the two given array may be repeated but cannot be repeated in union and intersection array.| Report Duplicate | Flag | PURGE

Amazon Data Engineer test - 1of 1 vote

Answersfind nearest word from the given non-english dictionary which is one off character. (could be non ascii characters)

- prathji October 01, 2019 in United States

for eg. dictionary contains { apple, pineapple, banana, orange }

if given word "applx" then return true, as applx matches with apple and only one character is off.

aplpe returns false| Report Duplicate | Flag | PURGE

Google Software Developer - 0of 0 votes

AnswerGiven a square (n x n) matrix which only contains 0 and

- danishm026 September 29, 2019 in India

1. Find the minimum cost to reach from left most column to rightmost column.

Constraints/rules:

a. Starting point: You can start from any cell in the left most column i.e. (i, 0) where i can be between 0 and n( number of rows/ columns)

b. Destination: You can reach any cell in the rightmost column i. e ( k, n) where k can be anything between 0 and n.

c. You cannot visit a cell marked with 0.

d. Cost is defined as the sum of cells visited in path.

e. You can move up, down, left and right but not diagonally.

For example,

take 2x2 matrix

1 | 0

1 | 1

One possible path is 00 -- 10 -- 11 with cost 3

Other one is 10 -- 11 with cost 2

so minimum cost on this case is 2.| Report Duplicate | Flag | PURGE

unknown Random Algorithm Data Structures - 0of 0 votes

AnswersWhat is the next number in the series 16,24,54,115

- sowmyapadi4444 September 23, 2019 in United States| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersWhat is the next number in the series 76,24,54,115

- sowmyapadi4444 September 23, 2019 in United States| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersDescribe the Flyweight and Visitor design pattern with example

- bharsaklemukesh975 September 22, 2019 in India| Report Duplicate | Flag | PURGE

Qualcomm Software Engineer / Developer Object Oriented Design - 0of 0 votes

AnswersYou have a vector of 128 floats (float data[128]) in shared memory, an environment with 8 threads and a convenient function called barrier() that will block on each thread until it will be signaled by all 8 threads (a simple semaphore of 8 elements).

- bharsaklemukesh975 September 22, 2019 in India

Write a pseudo-C parallel function that calculates the sum of all 128 elements storing it inside data[0]; the function can alter/destroy the content of the other 127 elements of data[].

thread_id goes from 0 to 7: it is constant and unique for each of the 8 threads.| Report Duplicate | Flag | PURGE

Qualcomm Software Engineer / Developer Operating System - 0of 0 votes

AnswersConsider the following 3D scene representing an old town's main square:

- bharsaklemukesh975 September 22, 2019 in India

• A single statue

o static geometry, high polygon count

o low complexity fragment shader

• A particle system simulating smoke

o animated, rendered as a large set of points

• A small set of characters

o animated geometry, medium polygon count

o medium complexity fragment shader

• A large set of buildings

o static geometry, low polygon count

o low complexity fragment shader

• A background image/skybox

• The camera/viewpoint is continuously moving within the scene.

How would you render the statue - by itself – using OpenGL to achieve maximum vertex performance (vertices/second)?

How would you render the particle system - by itself - using OpenGL to achieve maximum vertex performance (vertices/second)?

How would you render the scene - as a whole - most efficiently on a GPU using OpenGL?

Given that the 3D scene was being rendered correctly but that you wanted to improve the performance further, how would you determine if the main performance limitation/bottleneck was located in the application, in the vertex processing stage, or in the fragment processing stage?| Report Duplicate | Flag | PURGE

Qualcomm Software Engineer / Developer Graphics - 0of 0 votes

AnswerThere are cards and each card has an identity. e.g. HC1 has ID 1, this ID also represents the cost of the card. Your sister already have some cards and you want to gift her cards which she do not have already. Program is to return the max number of cards you can buy for her.

- acharyashailendra1 September 19, 2019 in India

Constraint : You have amount d, and want to buy as many distinct card as you can.

e.g. Sister Cards = [2, 3, 5], D : 7 Card you buy : 1, 4

Output : 2| Report Duplicate | Flag | PURGE

SDE-2 - 0of 0 votes

AnswersYou have been given a special and normal status of alphabets.

- acharyashailendra1 September 19, 2019 in India

e.g. “01111001111111111011111111” represents “abcdefghijklmnopqrstuvwxyz”. Here 0 represents normal character and 1 represents special character.

Given an Input String S and a number k, find the maximum continuous sub array with maximum k number of number elements. There is no constraint on special character.

e.g.

S = “giraffe”, K = 1, “011110011111111110111111”

Output : 3

How ?

normal characters : a, g, f

one of the possible solution : gir (as this has only one normal character)| Report Duplicate | Flag | PURGE

SDE-2 - 0of 0 votes

AnswerGiven a binary String which represents the target state. Minimum number of flips needed to convert a same size Binary String (with all 0’s) to target state. A flip also causes all the right bits to be flipped.

- acharyashailendra1 September 19, 2019 in India

e.g.

Input : 00101 (Represents Target)

Output : 3

Explanation :

00000 -> 00111 -> 00100 -> 00101| Report Duplicate | Flag | PURGE

SDE-2 - 0of 0 votes

AnswersGiven a level K , you have to find out the sum of data of all the nodes at level K in a binary tree. Input is given as:

- Notagoodcoder September 19, 2019 in United States

(P(C()())(C()())) P is for Parent, C is for child. if parent has one child : (P(C()())()) if parent has no child : (P()())| Report Duplicate | Flag | PURGE

Samsung - 0of 0 votes

AnswersCreate Valid html from below input.

- samfriendcom1234 September 18, 2019 in United States

String str="abcde"

points:- [{0,2,b},

{2,4,u}]

output : <b>ab<u>c</u></b><u>de</u>

Explanation:- character from 0 to 2 index should be bold, 2 to 4 index should be underline. Tricky point is that character at index 2 should be both bold and underline.| Report Duplicate | Flag | PURGE

xyz SDE1 - 0of 0 votes

AnswersN cows are standing at the origin on x-axis, each cow has some appetite, in other word hunger index. A cow can sleep of 1 unit of time or eat for one unit of time or move left or move right. There are some vessels placed on the x-axis, they are having infinite supply of fiod. Find minimum time in which all cows appetite would be filled.

- xyz September 15, 2019 in United States

Input:

cow Apetitte = {1,1}

Vessle locations = {-1,1}

Answer would be 2 since both cow can go in different direction they would eat for one seconds. One second for moving and one second for eating.

This problem looks to be similar to rotten eggs/tomatoes.| Report Duplicate | Flag | PURGE

Allegient SDE-2 Algorithm - 0of 0 votes

Answershow to find the fastest xor of large subarray or given range?

`print(reduce(xor,arry[qury[1]-1:qury[-1]]))`

but it's not working for larger input

- Dhioyt September 14, 2019 in United States| Report Duplicate | Flag | PURGE

HackerEarth - 2of 2 votes

AnswersDesign a voting system. 100M users will be logging in within a window of 24h (not necessarily uniformly). Every user will be able to choose from a fixed list of options. If the user has already voted the system should not let them to vote a second time. Additional constraint: only the first 100K votes are accepted. If the quota is exceeded any attempt to vote should be rejected.

- adr September 12, 2019 in United States| Report Duplicate | Flag | PURGE

Software Engineer System Design - 0of 2 votes

AnswersA special palindrome is a palindrome of size N which contains atmost K distinct characters such that any prefix between the size 2 to N-1 is not a palindrome.

- Prashanthwagle360 September 08, 2019 in India

You need to count the number of special palindromes

For example, abba is a special palindrome with N=4 and K=2 and ababa is not a special palindrome because aba is a palindrome and its a prefix of ababa.

If N=3, K=3, possible special palindromes are aba, aca, bab, bcb, cac and cbc. So answer will be 6.

Input format

Two integers N and K

Output format

Answer modulo 10^9+9

Constraints

1<=N,K<=10^9

Sample TC

3 3

Output

6| Report Duplicate | Flag | PURGE

HackerEarth Problem Setter Algorithm - 1of 1 vote

AnswersGiven a length n, count the number of strings of length n that can be made using ‘a’, ‘b’ and ‘c’ with at-most one ‘b’ and two ‘c’s allowed.

- Nits September 07, 2019 in United States| Report Duplicate | Flag | PURGE

Facebook Software Development Manager Algorithm - 0of 0 votes

AnswersNext Sunday is Ayan’s 4th birthday and a lot of guests are invited for his birthday celebration. All of them are getting gifts for Ayan and his y-1 number of siblings. There are x number of guests coming to the party and each of them presented each kid some integer number of gifts (possibly zero). The guests are numbered with integers from 1 to x and all kids are numbered with integers from 1 to y. For all 1 ≤i ≤x the minimum number of gifts, which i-th guest presented to some kid is equal to gi and for all 1 ≤j ≤y the maximum number of gifts, which j-th kid received from some guest is equal to kj.

- anoophky September 06, 2019 in United States

Let ai,j be the number of gifts which the i-th guest give to the j-th kid. Then gi is equal exactly to the minimum among values ai,1,ai,2,…,ai,y and kj is equal exactly to the maximum among values g1,j,g2,j,…,gx,j.

You are interested in the minimum total number of gifts that guests could present, so you need to minimize the sum of ai,j for all (i,j) such that 1 ≤i ≤x and 1 ≤j ≤y. You are given the numbers g1,…,gx and k1,…,ky, determine this number.

Input Format

The first line contains two integers x and y, separated with space — the number of guests and kids, respectively (2≤x,y≤100000). The second line contains x integers g1,…,gx, separated by spaces — gi is equal to the minimum number of gifts, which i-th guest presented to some kid (0≤gi≤1000). The third line contains y integers k1,…,ky, separated by spaces — kj is equal to the maximum number of gifts, which j-th kid received from some guest (0≤kj≤1000).

Output Format

If the described situation is impossible, print −1. In another case, print the minimum total number of gifts, which guests could have presented and all conditions could have satisfied.

Sample Input

3 2

1 2 1

3 4

Sample Output

12| Report Duplicate | Flag | PURGE

- 0of 0 votes

AnswersMr. Stark is the owner of Stark industries, a manufacturer of weaponry.

- anoophky September 06, 2019 in United States

A local Mafia group has hijacked one of the factories in the desert.

The mafias want to transport the weapons from the factory to their base camp, and use a single truck to do it.

But, every kilometer the truck travels with the weapons, one weapon falls off and breaks. The truck can only travel integral values of distance, and will lose 1 weapon for every km travelled.

The weapons can be unloaded at any point from the truck, and can be picked up again later.

Given the number of weapons X, max capacity of the truck Y and distance between the factory and the base Z, find the maximum number of weapons that can be transferred intact from the factory to the mafia base.

Function Description:

findMaxWeapons function takes the following parameters:

X - the number of weapons

Y - max capacity of the truck

Z - distance between the factory and the base| Report Duplicate | Flag | PURGE

- 0of 0 votes

Answeryou are given string of digits, a value x and N. you have to divide that string in ((i-1)*x+1,min(i*x)) parts.

- acharyashailendra1 September 05, 2019 in India

for example a String is ="1234567891" and x=5,N=10 then

there will be 2 partition of string since x=5

[12345] end [67891]

you have to find kth min number from these combinations. for example k=3 then ans should be 17

combination will happen like every digit from 1st partition will concanate with other partition digits

so if there were three partition for string 123456789 then it could be like

[123][456][789]

and if k=3 then ans would be 149| Report Duplicate | Flag | PURGE

- 0of 0 votes

Answersrecently I came across one good design question. I need your thoughts how to proceed. Assume a big IT hub, like any co-work space / Microsoft / amazxon/ google etc office (which has multiple floors , each floor has multiple meeting rooms , work stations etc) . At any point of time , an admin should be able to know 1. how many people are there in that facility 2. How many people at each floor wise 3. If he chooses any cons room, he must be able to fetch how many people in that conf room at that time . This normally used for any kind of evacuation etc

- gopi.komanduri September 02, 2019 in United States

I tried with http protocol , but interviewer said http is over kill , he hints on some IoT communication etc .. however , want to know what is the best way to solve it| Report Duplicate | Flag | PURGE

System Design - 0of 0 votes

AnswersA string can contain only a, b or c. There cannot be 2 consecutive same character. First and the last character cannot be the same. Now given a string with ‘a’, ‘b’, ‘c’ or ‘?’. We need to find the string replacing ‘?’ that satisfy the above conditions. For multiple-answer display lexicographically smallest string. For no answer possible display “Not Possible”.

- anoophky August 31, 2019 in India| Report Duplicate | Flag | PURGE

Directi SDE1 String Manipulation - 0of 0 votes

Answersrepeat string n^n times without using extra space

- acharyashailendra1 August 30, 2019 in India| Report Duplicate | Flag | PURGE

Myntra - 0of 0 votes

AnswerDesign and implement rate limiter for limiting api calls for a service distributed multiple users.

- acharyashailendra1 August 27, 2019 in India| Report Duplicate | Flag | PURGE

SDE-2 - 0of 0 votes

AnswerDesign data structures which support millions of products coming in streaming manner, we need to find at any moment what are top n products at any day

- acharyashailendra1 August 27, 2019 in India| Report Duplicate | Flag | PURGE

SDE-2 - 0of 0 votes

AnswersYou run a linux binary provided by a customer and don’t get any output. The customer assures you it should provide output. You don’t have the source code for this binary. How would you debug this? What tools / techniques can you use ? *

- donk August 26, 2019 in United States for Engineering| Report Duplicate | Flag | PURGE

Notfamous Technical Support Engineer Unix - 0of 0 votes

AnswersA customer raises a support ticket as they have a serious situation which has caused them data loss. You determine the issue is a bug in the product which is already fixed in a later version. Please write a response to the customer support ticket.

- donk August 26, 2019 in United States for Engineering| Report Duplicate | Flag | PURGE

Notfamous Technical Support Engineer Trouble shooting

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window