Documentation
¶
Overview ¶
Package steadygene: https://www.hackerrank.com/challenges/bear-and-steady-gene/problem Problem:
We are given a string that contains at most four different characters, of length n ( multiple of 4 ). We need to find the smallest substring, that we can replace with any other string of same size, such that all four characters will be found in the original string in equal number, n / 4 Solution:
We find the minimal length of a substring that needs to be replaced. We then loop through all substrings of greater length and check that it contains at least the crachters that need to be replaced. We go to the next substring by advancing its starting char or its size as much as possible. And we make optimizations about caching previous calculations of contained chars.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SteadyGene ¶
Types ¶
This section is empty.