Last active
August 27, 2020 19:30
-
-
Save kavilivishnu/f93ef1d0df10ddd58b1aea9185f87609 to your computer and use it in GitHub Desktop.
Harlod and his homework from Goldman Sachs coding exam 2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Harlod and his homework | |
''' | |
money = [20, 54, 41] | |
deadline = [3, 4, 5] | |
money1 = [60, 40, 80] | |
deadline1 = [1, 2, 2] | |
lst = min(deadline) | |
res = list(filter(lambda i: i >= lst, deadline)) | |
if res != 0: | |
print(sum(money)) | |
else: | |
pass | |
c = 2 | |
if c in deadline1: | |
deadline1.remove(c) | |
deadline1.append(c) | |
else: | |
pass | |
d = min(money1) | |
money1.remove(d) | |
e = sum(money1) | |
print(e) | |
Harlod and his homework - (without inputs) | |
money = [] | |
deadline = [] | |
money1 = [] | |
deadline1 = [] | |
lst = min(deadline) | |
res = list(filter(lambda i: i >= lst, deadline)) | |
if res != 0: | |
print(sum(money)) | |
else: | |
pass | |
for i in deadline1: | |
c = i | |
if c in deadline1: | |
deadline1.remove(i) | |
deadline1.append(i) | |
else: | |
pass | |
d = min(money1) | |
money1.remove(d) | |
e = sum(money1) | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment