Cant find whats wrong with my approach to Sept-CookOff Problem Counting Strings

Правка en1, от Ishan.nitj, 2016-09-20 16:57:16

Problem My Solution

Let us consider the string in problem as S and the string that we generate as T.

What my solution does it:

Solve(1,S.size()):

Ans=0

1)If the first and last character of S and T are same,Ans+=Solve(2,s.size()-1)

2)If the first and last character of T are greater than S, then we can place any charcters from [2,S.size()-1].

3)If first character of T =first character of S,but last character of T is > last character of S,then we have to make sure that T[2,S.size()-2]>=S[2,S.size()-2]

4)If first character of T > first character of S,but last character of T is = last character of S,then we have to make sure that substring T[S.size()-2,2]>=S[S.size()-2,2]

Base Conditions: Solve(x,y) if x<y return 0
Solve(x,y) if x==y return ('Z'-S[x])

Here A[x,y] denotes substring of A from index x to y inclusive.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Ishan.nitj 2016-09-20 16:57:16 1044 Initial revision (published)