Bulls and Cows - LeetCode September Challenge Week 2.3
[Practice 5/9/2021] LeetCode 299. Bulls and Cows
Bulls and Cows | leetcode 299
Комментарии
Here the secret and guess strings are the same lengths, so n=m for the time and space complexities, now will be O(n), still linear.
SagarSharma-usru
Thank you so much for this great explanation. I am having troubles in understanding this line:
if num in count_secret:
if count_secret[num] > 0:
cows += 1
count_secret[num] -= 1
Could you please explain as to why we are having the second if condition? Thank you.