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.
When you divide by 3, you get remainder 0 or 1 or 2. If it 0, we can have a stirng of all 5's. If the remainder is 1, then if you subtract 10 ( which is 3 * 3 + 1) then the number is divisible by 3 -- however, number should be atleast 10. If remainer is 2, then if you subtract 5 (which is 3 *1 + 2) then the number is divisible by 3 -- however number should be at least 5. Otherwise, print -1.
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
My solution in python 3:
When you divide by 3, you get remainder 0 or 1 or 2. If it 0, we can have a stirng of all 5's. If the remainder is 1, then if you subtract 10 ( which is 3 * 3 + 1) then the number is divisible by 3 -- however, number should be atleast 10. If remainer is 2, then if you subtract 5 (which is 3 *1 + 2) then the number is divisible by 3 -- however number should be at least 5. Otherwise, print -1.