This question was asked in Google's interview.
The question reads as:-
Given 2 integers A & B and an array of integers C of size N. Elements C[I] represents the length of I th board.
You have to paint all N boards [C0, C1, C2, C3, ........, CN-1]. There are A painters available and each of them takes B unit of time to paint 1 unit of board.
Calculate and return the minimum time required to paint all the boards under the constraint that any painter will only pain continuous selection of board.
- 2 painters cannot share a board to paint. That is to say, a board cannot be painted partially by one painter, and partially by another.
- A painter will only paint continuous boards. Which means configuration where painter 1 paints boards 1 and 3 but not 2 is invalid.
In this scenario similar to the book allocation question, the allocation is made in a continuous manner and hence we can use the binary search.
Let's see the solution to the program.
Subscribe @TAPACADEMY for regular learnings.
Check out our FREE DSA course playlist here - • Data Structures And Al...
For more information, fill this form: forms.gle/8eiUmM92Fx563Aen9
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacademy.com
#binarysearch #java #dsa #job #itjob #array #questions #placement
Негізгі бет Painter's Partition Problem In Binary Search | FREE DSA Course in JAVA | Lecture 60
Пікірлер: 7