It was a Professional level coding test, where we were given 4 hours to solve One problem.
There is a highway that has damages at N (4<=N<=100) locations. Each damage location is represented by a number a (0<=a<=10000). You need to repair these damages with Asphalt. The damage is repaired with these rules:
- Asphalt can be spread on the road with a minimum stretch of K (1<=K<=10000) i.e. each time you put asphalt, it will be spread to k consecutive locations. eg. if the damage is at locations 2, 5 and K=3 then the first asphalt spread is from 0-2 or 1-3 or 2-4 and the second is from 3-5 or 4-6 or 5-7.
- You need to spread minimum Asphalt to repair all damaged locations of the road. For the above example, the minimum asphalt required is 4 units ( 2-4 and 3-5) because 3-4 is overlapping.
Example test cases:
A A …….. A[N-1]
Minimum Asphalt area to repair all damages.
0 10 2 12 4 14 6 16 8 18
3 9 11 8
2 7 20 5 19 9 6 22
Please let me know if there is any confusion in the question!!
- Samsung Interview Experience | On-campus for Samsung Research Institute,Bangalore
- Samsung Interview Experience | Set 3 (Samsung Research Institute, Bangalore)
- Samsung Interview Experience | On-campus for Samsung R&D, Bangalore
- Samsung Bangalore (SRI-B) Interview Experience
- Samsung Bangalore (SRIB) Interview Experience | Set 24
- Samsung R&D Bangalore | Interview Experience (On Campus FTE)
- Samsung Bangalore Internship Interview Experience 2018
- Samsung Bangalore (SRIB) Interview Experience | Set 25 (For Internship)
- Samsung R&D Bangalore Interview Experience (On-Campus 2019)
- Samsung Bangalore (SRIB) Interview Experience | Set 26 (For Internship)
- Samsung Bangalore (SRIB) Interview Experience | For Internship
- Samsung Bangalore(SRIB) On-campus Interview Experience
- Samsung Bangalore (SRIB) Interview Experience | Set 23 (For Internship)
- Samsung Bangalore Interview Experience for Research Profile
- SAMSUNG R&D - BANGALORE (SRIB) | INTERVIEW EXPERIENCE - 2019 | ON-CAMPUS
- Samsung Software - Competency Test (Samsung R&D Bangalore) Experience > 1 yrs
- Samsung R & D Bangalore internship experience (2018)
- Samsung R&D (Bangalore) On Campus Internship Experience 2019
- Factset Interview Experience (On-Campus Hire Drive)
- Amazon Interview Experience (SDE-1, 8 month experience, Refferal)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.