mkmeden's blog

By mkmeden, history, 2 weeks ago, In English

https://www.hackerrank.com/challenges/bear-and-steady-gene/problem

Can someone please explain why my code is not passing some test cases.

Code
 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by mkmeden (previous revision, new revision, compare).

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by mkmeden (previous revision, new revision, compare).

»
2 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Consider the case:

n = 12 gene = AAAACCCCGGGG

Your Code returns 3. But you need to replace at least one A, one C and one G. And the minimum substring that contains those three letters has length 6.