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,060 views

All past online assesments of Google can be found using the tag "google_oa" in the search bar.

Here is the link :  https://www.desiqna.in/tag/google_oa

in Online Assessments by Expert (34,270 points) | 1,060 views

1 Answer

0 like 0 dislike

Google Online Assessment (OA) - Maximum Area Serving Cake

Given an array of positive integers representing the radii of circular pizzas and the number of guests at a movie party, return the size of the largest piece of pizza (rounded to 4 decimal places) that can be cut so that every guest gets a slice of pizza with the same size. It is not possible that a single slice has some part of one pizza and some part of another pizza, and each guest gets only once slice of pizza.

Constraints:

  • 1 <= number of pizzas <= 1000
  • 1 <= radii[i] <= 1000
  • 1 <= number of guests <= 1000

Examples

Example 1:

Input:

radii = [1, 1, 1, 2, 2, 3]

guests = 6

Output: 7.0686

Explanation:

You can divide the pizza with a radius of 3 by 4: area 28.743 / 4 = 7.0686 to get 4 slices. Get the remaining 2 slices from the pizzas wth radius 2 because they have an area larger than 7.0686.

Example 2:

Input:

radii = [4, 3, 3]

guests = 3

Output: 28.2743

Example 3:

Input:

radii = [6, 7]

guests = 12

Output: 21.9911

by Expert (34,270 points)