Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
I don't think the solution is correct.

Popa Stefan

Jan 3, 2024

So for the following input:

"aba"

1

The expected output is 1!

Unless there is something I don't understand, by replacing the one b with an a we should have an expected value of 3 (aaa)

0

0

Comments
Comments
T
Thai Minh2 years ago

k is 1 so you can replace b which a hence the result is 3.

Design Gurus
Design Gurus8 months ago

The answer should be "3". Are you talking about the Python solution? Can you please share a screenshot of the code and the wrong output? Please make sure you don't have any local changes.

On this page