DEV Community

Discussion on: Algorithm Time: Secret Number

Collapse
 
spitz6860 profile image
spitz6860

I believe your new solution fails when secret = '0011', guess = '1100' because for (char in gHash) iterates through object keys, which means your function only returns 2 partials, instead of 4.
You can find the exact question here leetcode.com/problems/bulls-and-cows/ along with test cases and solutions.