## Online Test Interview Questions

- 0of 0 votes

AnswersYou are given a set of N horizontal lines which are connected by equal number of vertical lines to form squares of size 1x1. Now some segments are removed. You need to count the number of squares of all sizes (1x1, 2x2, ..., NxN) with all sides present.

- imunique August 30, 2017 in India

Image : https://he-s3.s3.amazonaws.com/media/uploads/1ce3516.png

In the above example you see four horizontal and vertical lines and few missing segments. Now you need to count the number of squares of all sizes with all sides.

Input :

First line is a positive integer N, number of horizontal and vertical lines.

Second line is positive integer M, number of segments removed.

Then there are m lines, each containing V,i,j or H,i,j where i and j are positive integers. H,i,j indicates a horizontal missing segment in the ith horizontal line between the jth and (j+1)th point on the line. V,i,j represents a gap in ith vertical line between the jth and (j+1)th point on the line.

Output :

Is the total number of squares in the figure with all sides along the remaining lines in the figure.

Sample Input :

4

4

H,2,1

H,3,1

V,2,2

V,2,3

Output :

5

Explanation : Here in this figure we have 4 squares of size 1x1 and 1 square of size 3x3, hence total is 5.| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm Data Structures Dynamic Programming Online Test Problem Solving - 1of 3 votes

AnswersGiven array of length n, having element 0 to n-1.

- DATA April 11, 2017 in United States

you are allowed to swap adjacent element only if Absolute difference of two element is equal to 1.

Is it possible to sort array.

If yes print sorted output.| Report Duplicate | Flag | PURGE

Yahoo Backend Developer Arrays Data Structures Math & Computation Online Test - 1of 1 vote

AnswersA = "ffgggtvshjsdhjfffffffhvjbjcharu"

- SPS March 14, 2017 in India

Find the max consecutive repitative chracter

Output : f -> 7| Report Duplicate | Flag | PURGE

Amazon Testing / Quality Assurance Online Test - 0of 0 votes

AnswersA = {1,2,4,-6,5,7,9,....}

- SPS March 14, 2017 in India

B = {3, 6, 3, 4, 0 .......}

n = 5 -> pairs whose sum is n

Output = (1,4), (5,0)....| Report Duplicate | Flag | PURGE

Amazon Testing / Quality Assurance Online Test - 3of 3 votes

AnswersHow to find efficiently the minimum of an array of integers that is the maximum of other arrays?

- wingchun0511 January 31, 2015 in France

Example:

A = [126, 110, 130]

B = [125]

C = [105, 115]

The minimum element of array A that is the maximum of B and C is 126| Report Duplicate | Flag | PURGE

Java Developer Algorithm Coding Java Online Test - 0of 0 votes

AnswersGiven a binary search tree and a number n, write a program to find the greatest number in the binary search tree less than or equal to N.

- gowthamiss27 December 21, 2014 in India

Given the following tree construction, what is the output for N=44?| Report Duplicate | Flag | PURGE

abc Applications Developer Online Test - 0of 0 votes

AnswersDescribe what’s incorrect about the following function and how you would fix the problems.typedef map< int, char *> List;void foo(){ List l; FILE *f = fopen("data.txt", "r"); if (f) { char line[100]; for (int i = 0; fgets(line, sizeof(line), f); ++i) { l[i] = new char[strlen(line)]; strcpy(l[i], line); } } for (List::const_iterator it = l.begin(); it != l.end(); ++it) { printf("%d: %s", it->first, it->second); }}

- prakashguy50 December 15, 2014 in India for SoftwareDevelopment| Report Duplicate | Flag | PURGE

ASAPInfosystemsPvtLtd Software Engineer / Developer Online Test - 0of 0 votes

AnswersThe function bar crashes when invoked. What is wrong and how would you fix the problem without changing anything in function bar?struct A { char *name; A() : name(NULL) { } ~A() { if (name) delete[] name; }};void bar(){ A x; x.name = new char[10]; strcpy(x.name, "John"); A y = x;}

- prakashguy50 December 15, 2014 in India for SoftwareDevelopment| Report Duplicate | Flag | PURGE

ASAPInfosystemsPvtLtd Software Engineer / Developer Online Test - 0of 0 votes

AnswersThe structure Info stores information of a person. Using a STL map, implement a collection of Info. The fields first and last must be used a unique, composite key. The list should be sorted by last, first in ascending order.typedef struct { string first, last; int age; string addr1, addr2;} Info;Also Using the map of Info from the question, output the list in reverse order. You may not define a new map or redefine the map you defined in the last question.

- prakashguy50 December 15, 2014 in India for SoftwareDevelopment| Report Duplicate | Flag | PURGE

ASAPInfosystemsPvtLtd Software Engineer / Developer Online Test - 2of 2 votes

AnswersThe stepping number:

- Anon October 13, 2014 in United States

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.| Report Duplicate | Flag | PURGE

Epic Systems Software Engineer / Developer Algorithm Data Structures Dynamic Programming Java Online Test - 0of 0 votes

AnswerHi,

- CodeNinja October 10, 2014 in United States

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?| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Online Test - 0of 0 votes

AnswersHi,

- CodeNinja October 10, 2014 in United States

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?| Report Duplicate | Flag | PURGE

Amazon Software Engineer / Developer Online Test

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

Open Chat in New Window