Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d6af820

Browse files
sandclock
1 parent 71c37f9 commit d6af820

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

‎Data Structure/1 Arrays - DS Reverse.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# https://www.hackerrank.com/challenges/arrays-ds/problem?isFullScreen=true
3+
4+
#!/bin/python3
5+
6+
import math
7+
import os
8+
import random
9+
import re
10+
import sys
11+
12+
#
13+
# Complete the 'reverseArray' function below.
14+
#
15+
# The function is expected to return an INTEGER_ARRAY.
16+
# The function accepts INTEGER_ARRAY a as parameter.
17+
#
18+
19+
def reverseArray(a):
20+
# Write your code here
21+
return a[::-1]
22+
23+
if __name__ == '__main__':
24+
# fptr = open(os.environ['OUTPUT_PATH'], 'w')
25+
26+
arr_count = int(input().strip())
27+
28+
arr = list(map(int, input().rstrip().split()))
29+
30+
res = reverseArray(arr)
31+
32+
print(' '.join(map(str, res)))
33+
34+
# fptr.write(' '.join(map(str, res)))
35+
# fptr.write('\n')
36+
37+
# fptr.close()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# https://www.hackerrank.com/challenges/2d-array/problem?isFullScreen=true
3+
4+
#!/bin/python3
5+
6+
import math
7+
import os
8+
import random
9+
import re
10+
import sys
11+
12+
#
13+
# Complete the 'hourglassSum' function below.
14+
#
15+
# The function is expected to return an INTEGER.
16+
# The function accepts 2D_INTEGER_ARRAY arr as parameter.
17+
#
18+
19+
def hourglassSum(arr):
20+
# Write your code here
21+
pass
22+
23+
if __name__ == '__main__':
24+
# fptr = open(os.environ['OUTPUT_PATH'], 'w')
25+
26+
arr = []
27+
28+
for _ in range(6):
29+
arr.append(list(map(int, input().rstrip().split())))
30+
31+
result = hourglassSum(arr)
32+
33+
print(str(result) + '\n')
34+
35+
# fptr.write(str(result) + '\n')
36+
37+
# fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /