-
Notifications
You must be signed in to change notification settings - Fork 1
/
CONTEST_2.PY
61 lines (33 loc) · 1.11 KB
/
CONTEST_2.PY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 1
# Minimise the maximum difference
# ou are given an array arr[ ], of n integers. Minimize the max difference between the pairs of adjacent array elements by inserting at most k elements in the array.
# Input:
# First line of input consists of number of test cases T. Then T test cases follow. In each test case, the first line holds the integer n, representing the size of array. Second line contains the n space separates values of array arr[ ]. Third line of test case holds the integer k.
# Output:
# The minimized max difference of adjacent array elements is printed in a new line for each test case.
# Input:
# 2
# 6
# 66 31 99 76 38 76
# 5
# 7
# 2 3 5 6 4 4 4
# 2
# Output:
# 23
# 1
# 2
# Valid Pair Sum
# Input:
# First line of input contains number of testcases T. For each testcase, there will be two lines, first of which will contain N. Second line contains N space separated integers.
# Output:
# Print number of valid pairs whose sum is greater that 0.
# Sample Input:
# 2
# 3
# 3 -2 1
# 4
# -1 -1 -1 0
# Sample Output:
# 2
# 0