Please help for this question

Правка en3, от 1_Hypex_, 2023-10-31 13:19:16

As an assignment, students at HackerLand High School are to find a subsequence using two strings by performing the below-mentioned operation. Given two strings firstString of length n and secondString of length m, the goal is to make secondString a subsequence of firstString by applying the operation any number of times. In one operation, any single character can be removed from the secondString. The goal is to find the minimum possible difference value which is calculated as: | maximum index of all the characters removed from the string secondString | — |minimum index of all the characters removed from the string secondString |+ 1. Removing a character from secondString does not affect the indices of the other characters and an enmpty string is always a subsequence of firstString.

Example n= 10, first-string = HACKERRANK m=9, secondString = HACKERMAN Remove the character at index 7 to change second string to "HACKERAN", a subsequence of firstString. The difference value is 7 -7+1 =1. Return 1.

Constraints " 1<=n<=10^5 " 1<=m<=10^5

Теги help, strings, subsequence problem

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский 1_Hypex_ 2023-10-31 13:19:16 0 Tiny change: 'As an assi' -> '\nAs an assi'
en2 Английский 1_Hypex_ 2023-10-31 13:06:55 0 (published)
en1 Английский 1_Hypex_ 2023-10-31 13:05:26 1114 Initial revision (saved to drafts)