FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
interview/python/array/arrayaddition.py at master · ankursd/interview · GitHub
ankursd
interview
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
interview
/
python
/
array
/
arrayaddition.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (40 loc) · 918 Bytes
Breadcrumbs
interview
/
python
/
array
/
arrayaddition.py
Copy path
File metadata and controls
46 lines (40 loc) · 918 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
def
add
(
arr1
,
arr2
):
l
=
max
(
len
(
arr1
),
len
(
arr2
))
result
=
[
0
for
j
in
range
(
l
)]
c
=
0
i
=
len
(
arr1
)
-
1
j
=
len
(
arr2
)
-
1
r
=
0
l
-=
1
while
i
>=
0
and
j
>=
0
:
r
=
arr1
[
i
]
+
arr2
[
j
]
+
c
i
-=
1
j
-=
1
c
=
r
//
10
result
[
l
]
=
r
%
10
l
-=
1
while
i
>=
0
:
r
=
arr1
[
i
]
+
c
i
-=
1
c
=
r
//
10
result
[
l
]
=
r
%
10
l
-=
1
while
j
>=
0
:
r
=
arr1
[
j
]
+
c
j
-=
1
c
=
r
//
10
result
[
l
]
=
r
%
10
l
-=
1
if
c
!=
0
:
new_result
=
[
0
for
j
in
range
(
len
(
result
)
+
1
)]
t
=
len
(
new_result
)
-
1
while
t
>
0
:
new_result
[
t
]
=
result
[
t
-
1
]
t
-=
1
new_result
[
0
]
=
c
return
new_result
return
result
arr1
=
[
9
,
9
,
9
,
9
,
9
,
9
,
9
]
arr2
=
[
1
,
6
,
8
,
2
,
6
,
7
]
result
=
add
(
arr1
,
arr2
)
print
(
result
)
Back
|
FazBrowse Home
|
New Git URL