Problem 2162. Let's get back to school: create mixed numbered fraction

A fractional number can be represented as mixed number.

A "mixed number" consists of an integer followed by a proper fraction and "proper fraction" is a fraction with the numerator smaller than the denominator.

e.g. if given fraction is, 1.33 then, it can be represented as 1 (1/3), meaning, (1*3+1)/3 = 4/3 = 1.33

The task is to convert the given fractional number into a mixed number and return the 3 digits as an array of length 3. For making it easy and to output unique solution, the integer should always be 1 and the remaining fraction need not be a "proper fraction". (so for input 1.33, output will be [1 1 3], for input 1.66, output will be [1 2 3] )

Solution Stats

40.48% Correct | 59.52% Incorrect
Last Solution submitted on Dec 23, 2019

Problem Comments