Skip to content

Commit

Permalink
Merge pull request #49 from saurabhgiri141/main
Browse files Browse the repository at this point in the history
Create apple-oranges-hackerank-solution.py
  • Loading branch information
3NCRY9T3R authored Oct 7, 2020
2 parents 6deefc8 + dac3ef4 commit 49e3649
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions apple-oranges-hackerank-solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import math
import os
import random
import re
import sys

# Complete the countApplesAndOranges function below.

def countApplesAndOranges(s, t, a, b, apples, oranges):

acount = 0

bcount = 0

for i in range(len(apples)):

temp = a+apples[i]

if(temp in range(s,t+1)):

acount+=1

for i in range(len(oranges)):

temp = b+oranges[i]

if(temp in range(s,t+1)):

bcount+=1

print (acount)

print (bcount)





if __name__ == '__main__':

st = input().split()

s = int(st[0])

t = int(st[1])

ab = input().split()

a = int(ab[0])

b = int(ab[1])

mn = input().split()

m = int(mn[0])

n = int(mn[1])

apples = list(map(int, input().rstrip().split()))

oranges = list(map(int, input().rstrip().split()))

CountApplesAndOranges(s, t, a, b, apples, oranges)

0 comments on commit 49e3649

Please sign in to comment.