I came across a question where we had to print N characters using insertion, deletion and copying characters on screen. Copying makes the no. of characters twice. Each operation has some time associated with it. We have to find the minimum time to produce N characters.
Question Link: https://practice.geeksforgeeks.org/problems/minimum-time/0
My approach fails on a test case where-
N=9, I=9, D=4, C=1
Correct O/P: 17
I can’t understand how it gives this answer.
When I tried the approach given in the editorial it fails on the same case.
Could someone please suggest a good approach to solve this question. Also, is it the test case that is wrong, or is it the editorial?