diff --git a/Picking Numbers/Picking_numbers.py b/Picking Numbers/Picking_numbers.py new file mode 100644 index 0000000..0b408ca --- /dev/null +++ b/Picking Numbers/Picking_numbers.py @@ -0,0 +1,30 @@ +#!/bin/python + +import math +import os +import random +import re +import sys + +# Complete the pickingNumbers function below. +def pickingNumbers(a): + count = [0 for i in xrange(101)] + for i in a: + count[i] += 1 + ans = 0 + for i in xrange(0, 100): + ans = max(ans, count[i] + count[i + 1]) + return ans + +if __name__ == '__main__': + fptr = open(os.environ['OUTPUT_PATH'], 'w') + + n = int(raw_input().strip()) + + a = map(int, raw_input().rstrip().split()) + + result = pickingNumbers(a) + + fptr.write(str(result) + '\n') + + fptr.close()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: