Skip to content

Commit

Permalink
Refactor to remove nested for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbotello committed Jan 6, 2017
1 parent 61e3322 commit 1b066f7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions challenge_5/python/alexbotello/FindTheDifference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
class Solution:
def findTheDifference(self, s, t):

s = dict(Counter(s))
t = dict(Counter(t))
s = Counter(s)
t = Counter(t)

for key in t.keys():
if key not in s.keys():
s[key] = 0
if s[key] - t[key] <= -1:
if s[key] != t[key]:
return key



if __name__ == '__main__':

test_case = Solution()
Expand Down

0 comments on commit 1b066f7

Please sign in to comment.