small strings (Google kick start round c)

Revision en2, by rakeshgvpcoe123, 2021-05-24 07:59:05

my solution has time complexity of O(n*k) k = first k characters from a to z n = size of string but solution got TLE how to optimize it? link to the question and my solution:

https://codingcompetitions.withgoogle.com/kickstart/round/0000000000435c44/00000000007ebe5e

https://www.codechef.com/viewsolution/46839080

thanks in advance

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English rakeshgvpcoe123 2021-05-24 07:59:05 229
en1 English rakeshgvpcoe123 2021-05-24 07:57:35 517 Initial revision (published)