arpankg/ctci-python-solutions

Solution 1.4 - Incorrect dictionary iterator

rohit-lunavara opened this issue · 1 comments

Line 43 should use the items() method over the dictionary to return (key, value) pairs.

for (key, value) in counts.items():

Or, use the values() method over the dictionary since we are only checking values.

for value in counts.values():

#8 Adds fix for the above and additional refactor to make code more pythonic