Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description:(PYTHON) possible ways to choose a pair of fractions that sum up to 1 . Since the answer can be large, provide it modulo 109+7(1,000,000,007).
Description:(PYTHON) possible ways to choose a pair of fractions that sum up to 1 . Since the answer can be large, provide it modulo 109+7(1,000,000,007). Note that a single fraction can form multiple pairs. Examples: 1.Given X=[1,1,2],Y=[3,2,3], the function should return 1. The input represents fractions 1/3,1/2,2/3, and the only pair that sums up to 1 is (1/3,2/3). 2. Given X=[1,1,1],Y=[2,2,2], the function should return 3 . The input represents 1/2,1/2,1/2. There are three ways to choose a pair that sums up to 1 . 3.Given X=[1,2,3,1,2,12,8,4],Y=[5,10,15,2,4,15,10,5], the function should return 10 . Write an efficient algorithm for the following assumptions: N is an integer within the range [0100,000]; -each element of arrays X,Y is an integer within the range [11,000,000,000] Input: Two list of integers. First list represents numerators, and second list represents denominators. Output: The number of possible ways to choose a pair of fractions that sum up to 1. Sample Input: [1,1,2],[3,2,3] Sample Output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started