steadygene

package
v0.0.0-...-9c3a112 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 0 Imported by: 0

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

func SteadyGene(gene string) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL