Last active
August 14, 2021 00:59
-
-
Save betaprojects/77f8703df437cba40a22d9edb4e12c26 to your computer and use it in GitHub Desktop.
Project Euler & HackerRank problem 99 solution: Find the largest exponential from a list of base/exponent pairs - solved using Python
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
# HackerRank solution | |
from math import log | |
v = [] | |
for _ in range(int(input())): | |
a, b = map(int, input().split()) | |
v.append((b*log(a), a,b)) | |
k = int(input()) | |
x, a, b = sorted(v)[k-1] | |
print (a, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment