How do I find the minimum number of operations?

Revision en1, by I_love_Saundarya, 2019-02-04 22:57:20

Problem-link : — https://www.hackerearth.com/practice/algorithms/dynamic-programming/2-dimensional/practice-problems/algorithm/shift-the-array-4074fac2/

You are given a string that contains lowercase English letters. In one step, you can choose a character and assign the next letter in the alphabet to it. (a-->b,b-->c,etc..and yea,z--->a). The number of indices where a[i]!=a[i+1] is given as f(string).

You are given a number 'k'.Now, your task is to determine the minimum number of steps required to perform on the string to obtain a string such that f(new-string)<=k.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English I_love_Saundarya 2019-02-04 22:57:20 641 Initial revision (published)