Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,258 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

image

 

in Online Assessments by Expert (44,360 points) | 1,258 views

2 Answers

0 like 0 dislike
Best answer
There are two solid hoops coloures in black. A hoop is area between two concentric cirlce with radius r and R (r<R). The two hoop lie on a completly white plane.

 

A colourful transition is a close continuos line through which there should be change of colour. Given co-ordinate of two hoops find the number of circular colourful transitions.

 

Input:

 

Input contains two lines: description of each hoop.

 

Each line contains 4 space seperated integers:

 

x,y,r,R

 

where x,y is co-ordinate of center of the hoop. r and R are the radii of the smaller and larger concentric circles of the hoop respectively.

 

Output:

 

A single integer: total possible number of circular colourful transition.

 

Constraints:

 

-100<=x,y<=100, 1<=r<R<=100

 

Sample Input

 

60 60 45 55

 

80 60 15 25

 

Sample Output

 

4
by Expert (44,360 points)
0 like 0 dislike

Not really sure about the colorful transition part. Here is an image of the graphs of the sample problem. https://ibb.co/LNbPfd3 I'm guessing it has something to do with basically the 5 cases:

 

  1. One hoop is completely outside the other
  2. One is completely inside the other (white space between the outer boundary of inner hoop, and inner boundary of outer hoop)
  3. One is partially inside the other
  4. One is partially outside the other
  5. One is both inside and outside the other (as in, there is white space on each side of the boundary)

 

In the sample case one hoop is touching the edge, so I would say that is case 3.

by Expert (44,360 points)