We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In that solution, when you create this range range(lcm_a, hcf_b+1) you are assuming hfc_b > lcm_a but that is not always the case.
For example in this test casegetTotalX( [3, 4] , [24, 28] )lcm_a = 12 and hfc_b = 4 so range(12,5) is empty and you return 0 which is not the correct answer.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Between Two Sets
You are viewing a single comment's thread. Return to all comments →
In that solution, when you create this range
range(lcm_a, hcf_b+1)
you are assuminghfc_b > lcm_a
but that is not always the case.For example in this test case
getTotalX( [3, 4] , [24, 28] )
lcm_a = 12
andhfc_b = 4
sorange(12,5)
is empty and you return 0 which is not the correct answer.