title: Check Number Is Perfect Square Using Additionsubtraction
signature: pub fn check_number_is_perfect_square_using_additionsubtraction(n: 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, expected: bool)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        1, 
        true
      ));
      
      println!("TEST-1...{}", driver(
        4, 
        true
      ));
      
      println!("TEST-2...{}", driver(
        9, 
        true
      ));
      
      println!("TEST-3...{}", driver(
        25, 
        true
      ));
      
      println!("TEST-4...{}", driver(
        36, 
        true
      ));
      
      println!("TEST-5...{}", driver(
        3, 
        false
      ));
      
      println!("TEST-6...{}", driver(
        121, 
        true
      ));
      
      println!("TEST-7...{}", driver(
        14, 
        false
      ));
      
      println!("TEST-8...{}", driver(
        17, 
        false
      ));
      
      println!("TEST-9...{}", driver(
        80, 
        false
      ));
      
  }
source_py: def check_number_is_perfect_square_using_additionsubtraction(n):
      i = 1
      the_sum = 0
      while (the_sum < n):
          the_sum += i
          if (the_sum == n):
              return True
          i += 2
      return False
source_cpp: bool check_number_is_perfect_square_using_additionsubtraction(int n) {
    for ( int sum = 0, i = 1;
    sum < n;
    i += 2 ) {
      sum += i;
      if ( sum == n ) return true;
    }
    return false;
  }