r/backtickbot • u/backtickbot • Feb 16 '21
https://np.reddit.com/r/datascience/comments/lkn4rl/please_stop_asking_data_scientists_about_leetcode/gnm0lxt/
I have a hard time believing that a large portion of DS you interview can't get to a basic solution for that problem. I'm not calling you a liar, I'm actually having a hard time comprehending that someone wouldn't be able to tackle something like that. I consider myself pretty mediocre at everything, and I still came up with a solution in a couple minutes.
stone_count = dict()
for x in stones:
if x in stone_count.keys():
stone_count[x] += 1
else:
stone_count[x] = 1
total = 0
for x in jewels:
if x in stone_count.key():
total += stone_count[x]
return total
1
Upvotes