Extra question: Largest possible numerator and denominator?


  • 0

    The given limits are pretty small, only up to 10 fractions with numerators and denominators in the range [1, 10]. It's to avoid overflow becoming an issue.

    Question 1: With the given limits, what is the largest numerator we might end up and what is the largest denominator we might end up?

    Question 2: How large could we make the limits so that the numerator and denominator of the result would still fit into 32-bit signed integers? Let's say we use a single limit number n so that up to n fractions were allowed with numerators and denominators in the range [1, n]. How large can we make n?


  • 0
    I

    largest denominator is 2520


  • 0

    @ibmtp380 Can you show some explanation/proof?

    Largest numerator/denominator I found are btw 164971/2520, from "9/5+10/7+9/8+10/9+10/1+10/1+10/1+10/1+10/1+10/1".


  • 0
    I

    2520 is the least common multiple of 1,2,3,4,5,6,7,8,9,10
    @StefanPochmann


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.