finish Level3/bomb baby #3

Merged
seongbeom_park merged 2 commits from level3/bomb-baby into main 2022-01-15 07:47:13 +00:00
3 changed files with 39 additions and 0 deletions
Showing only changes of commit 1eae269de3 - Show all commits

View File

@ -5,3 +5,11 @@
* Completed in: 2 days, 19 hrs, 36 mins, 16 secs.
* Reference
* L26.6 Absorption Probabilities, MIT OpenCourseWare, https://www.youtube.com/watch?v=vEsUsaK1HBk
### the-grandest-staircase-of-them-all
* Completed in: 16 hrs, 38 mins, 52 secs.
* DP
### bomb-baby
* Completed in: 1 hr, 46 mins, 55 secs.
* GCD

View File

@ -0,0 +1,23 @@
def solution(x, y):
return gcd(int(x), int(y))
def gcd(x, y):
count = 0
while y != 0:
t = x % y
count += x//y
x, y = y, t
if x != 1:
return 'impossible'
return str(count-1)
tests=[
[['4', '7'], '4'],
[['2', '1'], '1'],
[['2', '4'], 'impossible'],
]
for test in tests:
result = solution(*test[0])
print(test[0][0], test[0][1], result == test[1], result, test[1])
print ''

8
recruitme.txt Normal file
View File

@ -0,0 +1,8 @@
Checking your permissions...
Share solutions with a Google Recruiter?
If you opt in, Google Staffing may reach out to you regarding career opportunities, events, and programs. We will use your information in accordance with our Applicant and Candidate Privacy Policy.
Applicant and Candidate Privacy Policy.
[#1] [Yes [N]o [A]sk me later:]
[Y]es [N]o [A]sk me later: A
Response: contact postponed.
To share your progress at any time, use the recruitme command.