APT DivToZero

Class

public class DivToZero { public int lastTwo(int num, int factor) { // fill in code here } }

Problem Statement

You are given an integer num from which you should replace the last two digits such that the resulting number is divisible by factor and is also the smallest such number. Return the value of the last two replacement digits as an integer. (Thus ignoring leading zeros.)

For instance:

Constraints

Examples

  1. 
    num = 2000000000
    
    factor = 100
    
    Returns: 0
    
    

  2. 
    num = 1000
    
    factor = 3
    
    Returns: 2
    

  3. 
    num = 23442
    
    factor = 75
    
    Returns: 0
    

  4. 
    num = 428392
    
    factor = 17
    
    Returns: 15
    

  5. 
    num = 32442
    
    factor = 99
    
    Returns: 72