title: Check Number Power K Using Base Changing Method
signature: pub fn check_number_power_k_using_base_changing_method(n: i32, k: i32) -> bool {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: bool, expected: bool)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, k: i32, expected: bool)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n, k), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        64, 4, 
        true
      ));
      
      println!("TEST-1...{}", driver(
        16, 2, 
        true
      ));
      
      println!("TEST-2...{}", driver(
        27, 3, 
        true
      ));
      
      println!("TEST-3...{}", driver(
        81, 72, 
        false
      ));
      
      println!("TEST-4...{}", driver(
        1, 9, 
        true
      ));
      
      println!("TEST-5...{}", driver(
        69, 17, 
        false
      ));
      
      println!("TEST-6...{}", driver(
        8, 20, 
        false
      ));
      
      println!("TEST-7...{}", driver(
        31, 79, 
        false
      ));
      
      println!("TEST-8...{}", driver(
        43, 81, 
        false
      ));
      
      println!("TEST-9...{}", driver(
        54, 89, 
        false
      ));
      
  }
source_py: def check_number_power_k_using_base_changing_method(n, k):
      oneSeen = False
      while (n > 0):
          digit = (n % k)
          if (digit > 1):
              return False
          if (digit == 1):
              if oneSeen:
                  return False
              oneSeen = True
          n //= k
      return True
source_cpp: bool check_number_power_k_using_base_changing_method(unsigned int n, unsigned int k) {
    bool oneSeen = false;
    while ( n > 0 ) {
      int digit = n % k;
      if ( digit > 1 ) return false;
      if ( digit == 1 ) {
        if ( oneSeen ) return false;
        oneSeen = true;
      }
      n /= k;
    }
    return true;
  }