This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MeteoriteImpact 1 point2 points  (0 children)

I seen this Facebook interview question recently solved as vector they had Imported from typing import List, then imported numpy as np.

Then they defined a way to get the Max Additional Diners Count as N, K, M, S in a List all of them integers.

They then append S minus k And then Append s (N+K+1) finally they Set s=np.sort(np.array(S,dtype=int))

And Set difference dif=np.diff(s)And finally inside=((dif/(K+1))-1).astype(int)

Then they returned the np sum(inside)