summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AlgoDesignAndTechniqueEdxPython/sources/maxpairproduct.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/AlgoDesignAndTechniqueEdxPython/sources/maxpairproduct.py b/AlgoDesignAndTechniqueEdxPython/sources/maxpairproduct.py
new file mode 100644
index 0000000..380808e
--- /dev/null
+++ b/AlgoDesignAndTechniqueEdxPython/sources/maxpairproduct.py
@@ -0,0 +1,18 @@
+# Uses python3
+
+bigger = 0
+biggest = 0
+
+n = int(input())
+a = [int(x) for x in input().split()]
+
+for i in range(n):
+ if a[i] > biggest:
+ bigger = biggest
+ biggest = a[i]
+ elif a[i] == biggest:
+ bigger = a[i]
+ elif a[i] > bigger:
+ bigger = a[i]
+
+print(bigger * biggest)