Skip to content

Commit c4d5776

Browse files
committed
Upated python code version and modified solutions under BuiltIns subdomain
1 parent 3a3f572 commit c4d5776

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

BuiltIns/AnyorAll.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
6+
Updater : Imtiaz Ahmed
67
Created : 15 July 2016
8+
Updated : 29 August 2022
79
Problem : https://www.hackerrank.com/challenges/any-or-all/problem
810
'''
9-
n = int(input())
10-
ar = list(map(int,input().split()))
11-
ar = sorted(ar)
12-
if(ar[0]<=0):
11+
12+
ar = sorted(input().split())
13+
14+
if ar[0] < 0:
1315
print(False)
1416
else:
1517
chk = False
1618
for i in ar:
17-
s = str(i)
18-
if (s==s[::-1]):
19+
if i == i[::-1]:
1920
chk = True
2021
break
21-
print(chk)
22+
print(chk)

BuiltIns/AthleteSort.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Atharva Shah
6+
Updater : Imtiaz Ahmed
67
Created : 3 April 2021
8+
Updated : 30 August 2022
79
Problem : https://www.hackerrank.com/challenges/python-sort-sort/problem
810
'''
911

10-
import sys
12+
if __name__ == '__main__':
13+
n, m = map(int, input().split())
1114

12-
if __name__ == "__main__":
13-
n, m = input().strip().split(' ')
14-
n, m = [int(n), int(m)]
1515
arr = []
16-
for arr_i in range(n):
17-
arr_t = [int(arr_temp) for arr_temp in input().strip().split(' ')]
18-
arr.append(arr_t)
19-
k = int(input().strip())
16+
17+
for _ in range(n):
18+
arr.append(list(map(int, input().rstrip().split())))
19+
20+
k = int(input())
2021

21-
sorted_arr = sorted(arr, key = lambda x : x[k])
22-
for row in sorted_arr:
23-
print(' '.join(str(y) for y in row))
22+
for i in sorted(arr, key= lambda x: x[k]):
23+
print(*i)

BuiltIns/Zipped.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
6+
Updater : Imtiaz Ahmed
67
Created : 15 July 2016
8+
Updated : 30 August 2022
79
Problem : https://www.hackerrank.com/challenges/zipped/problem
810
'''
9-
n, x = map(int,input().split())
10-
ar = [0 for i in range(n)]
11-
for i in range(x):
12-
temp_ar=list(map(float,input().split()))
13-
for j in range(n):
14-
ar[j] += temp_ar[j]
15-
for i in range(n):
16-
print(ar[i]/x)
11+
12+
N, X = map(int, input().split())
13+
scores = []
14+
for _ in range(X):
15+
scores.append(list(map(float, input().split())))
16+
for i in zip(*scores):
17+
print(sum(i)/len(i))

BuiltIns/ginortS.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
Subdomain : Built-Ins
44
Domain : Python
55
Author : Ahmedur Rahman Shovon
6+
Updater : Imtiaz Ahmed
67
Created : 15 July 2016
8+
Updated : 29 August 2022
79
Problem : https://www.hackerrank.com/challenges/ginorts/problem
810
'''
11+
912
s = input()
10-
s = sorted(s,key = lambda x:(x.isdigit() and int(x)%2==0, x.isdigit(),x.isupper(),x.islower(),x))
11-
print(*(s),sep = '')
13+
print(''.join(sorted(s, key=lambda x: (x.isdigit() and int(x)%2==0, x.isdigit(), x.isupper(), x.islower(), x))))

0 commit comments

Comments
 (0)