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

0% completed

Vote For New Content
Is example 3's explanation correct? Seems like you could remove one instance of ...

Michael Latman

Jan 20, 2022

Is example 3's explanation correct? Seems like you could remove one instance of 5 and one instance of 4. But removing 4 alone does not jive with K=2

0

0

Comments
Comments
Design Gurus
Design Gurus4 years ago

You can't get more than 3 distinct numbers. Removing one 5 does not make 5 distinct. Either you can remove two 5s or one 4 - both give you three distinct numbers.

Removing one 4 gives us - 1,2,4 Removing two 5s gives us - 1,2,5 Removing one 5 and one 4 still gives us -...

On this page