title: Check If A Number Is Power Of Another Number
signature: class Solution {
  
      public Boolean checkIfANumberIsPowerOfAnotherNumber(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, Boolean 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(57, 1, true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(3, 9, true);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(10, 101, false);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(10, 10000, true);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(6, 46656, true);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(2, 2048, true);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(1, 40, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(20, 79, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(96, 98, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(25, 5, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer x, Integer y, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(x, y),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def check_if_a_number_is_power_of_another_number(x, y):
      if (x == 1):
          return (y == 1)
      pow = 1
      while (pow < y):
          pow = (pow * x)
      return (pow == y)
source_cpp: bool check_if_a_number_is_power_of_another_number(int x, long int y) {
    if ( x == 1 ) return ( y == 1 );
    long int pow = 1;
    while ( pow < y ) pow *= x;
    return ( pow == y );
  }