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 a79c54d

Browse files
Check if two arrays are equal or not
1 parent f2cf104 commit a79c54d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎Geeks-For-Geeks/Check-if-two-arrays-are-equal-or-not.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
Output : 0
3838
'''
3939
def equal(arr1, arr2):
40-
res = 0
40+
res1=res2 = 0
4141
for i in range(len(arr1)):
42-
res ^= arr1[i]
43-
res ^= arr2[i]
44-
return 0 if reselse 1
42+
res1 ^= arr1[i]
43+
res2 ^= arr2[i]
44+
return 1 if res1==res2else 0
4545

4646
t = int(input())
4747
while t > 0:

0 commit comments

Comments
(0)

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