title: Find Unit Digit X Raised Power Y 1
signature: class Solution {
  
      public Integer findUnitDigitXRaisedPowerY1(Integer x, Integer y) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer x, Integer y, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(x, y,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(37, 17, 7);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(70, 52, 0);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(26, 23, 6);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(9, 96, 1);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(82, 71, 8);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(95, 36, 5);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(43, 40, 1);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(7, 27, 3);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(19, 56, 1);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(49, 28, 1);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer x, Integer y, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(x, y),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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 );
  }