In your test case, which is the same I wrote about, there are two complete pairs: one pair of type 1, and one pair of type 2. There is a remainder sock of types 1 and 3. And that’s what the algorithm correctly outputs: 2 pairs of socks.

Where does your confusion lie?

--

--

--

Always learning.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Saul Feliz

Saul Feliz

Always learning.

More from Medium

CS 373 Spring 2022: Nisha Ramesh

Say Goodbye to Paper Health Records and Hello to MedChart

How to quickly configure Adobe Acrobat Sign SAML SSO with PingIdentity

Exceptions/Challenges/Errors while using the Asynchronous Apex (Batch apex, Future method…