4

Fraction pairs with sum 1

 1 year ago
source link: https://www.geeksforgeeks.org/videos/fraction-pairs-with-sum-1/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Fraction pairs with sum 1

August 09, 2023 |130 Views
Fraction pairs with sum 1
Problem of the Day, Array, Data Structures and Algorithms
 Save  Share   Like
Description
Discussion

In this video, we are given a list of N fractions, represented as two lists numerator and denominator, the task is to determine the count of pairs of fractions whose sum equals 1.

Example 1:

Input:
N = 4
numerator = [1, 2, 2, 8]
denominator = [2, 4, 6, 12]

Output:
2

Explanation:
Fractions 1/2 and 2/4 sum to 1. Similarly fractions 2/6 and 8/12 sum to 1. So there are 2 pairs of fractions which sum to 1.

Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/fraction-pairs-with-sum-1/1

Solution IDE Link: https://ide.geeksforgeeks.org/online-python3-compiler/710b8568-cb85-48b6-9f0b-2df86b8f3ae6

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK