title: Find Unit Digit X Raised Power Y 1
signature: function findUnitDigitXRaisedPowerY1(x: number, y: number): number {
test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: number, expected: number): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(x: number, y: number, expected:number): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(x, y),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver(37, 17, 7);
    console.log(`TEST-0...${result}`);
  
    result = driver(70, 52, 0);
    console.log(`TEST-1...${result}`);
  
    result = driver(26, 23, 6);
    console.log(`TEST-2...${result}`);
  
    result = driver(9, 96, 1);
    console.log(`TEST-3...${result}`);
  
    result = driver(82, 71, 8);
    console.log(`TEST-4...${result}`);
  
    result = driver(95, 36, 5);
    console.log(`TEST-5...${result}`);
  
    result = driver(43, 40, 1);
    console.log(`TEST-6...${result}`);
  
    result = driver(7, 27, 3);
    console.log(`TEST-7...${result}`);
  
    result = driver(19, 56, 1);
    console.log(`TEST-8...${result}`);
  
    result = driver(49, 28, 1);
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
source_py: def find_unit_digit_x_raised_power_y_1(x, y):
      x = (x % 10)
      if (y != 0):
          y = ((y % 4) + 4)
      return (int(math.pow(x, y)) % 10)
source_cpp: int find_unit_digit_x_raised_power_y_1(int x, int y) {
    x = x % 10;
    if ( y != 0 ) y = y % 4 + 4;
    return ( ( ( int ) ( pow ( x, y ) ) ) % 10 );
  }