Welcome to the daily solving of our PROBLEM OF THE DAY with Ayush Tripathi We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Dynamic Programming but also build up problem-solving skills.
Given an integer n denoting the Length of a line segment. You need to cut the line segment in such a way that the cut length of a line segment each time is either x , y or z. Here x, y, and z are integers.
After performing all the cut operations, your total number of cut segments must be maximum.
Note: if no segment can be cut then return 0.
Examples:
Input: n = 4, x = 2, y = 1, z = 1
Output: 4
Explanation: Total length is 4, and the cut
lengths are 2, 1 and 1. We can make
maximum 4 segments each of length 1.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/cutted-segments1642/1