➽ Problem:-
https://www.hackerrank.com/challenges/apple-and-orange/problem
➽ Solution:-
import math
import os
import
random
import re
import sys
a, b = input().strip().split('
')
a, b =
[int(a), int(b)]
c, d =
input().strip().split(' ')
c, d =
[int(c), int(d)]
x, y =
input().strip().split(' ')
x, y =
[int(x), int(y)]
apple = [int
(i) for i in input().strip().split(' ')]
orange =
[int (j) for j in input().strip().split(' ')]
apple_count
= 0
orange_count
= 0
for i in
range(len(apple)):
if (c+apple[i]) >= a and (c+apple[i])
<= b:
apple_count += 1
for j in
range(len(orange)):
if (d+orange[j]) >= a and (d+orange[j])
<= b:
orange_count += 1
print(apple_count)
print(orange_count)
0 Comments
Please do not enter any spam link in the comment section.