title: Check Number Is Perfect Square Using Additionsubtraction
signature: def check_number_is_perfect_square_using_additionsubtraction(n):
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;
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(n, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              n),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver(1, True)
      print(f"TEST-0...{result}")
  
      result = driver(4, True)
      print(f"TEST-1...{result}")
  
      result = driver(9, True)
      print(f"TEST-2...{result}")
  
      result = driver(25, True)
      print(f"TEST-3...{result}")
  
      result = driver(36, True)
      print(f"TEST-4...{result}")
  
      result = driver(3, False)
      print(f"TEST-5...{result}")
  
      result = driver(121, True)
      print(f"TEST-6...{result}")
  
      result = driver(14, False)
      print(f"TEST-7...{result}")
  
      result = driver(17, False)
      print(f"TEST-8...{result}")
  
      result = driver(80, False)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: check_number_is_perfect_square_using_additionsubtraction
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"n": 1}}, {"idx": 1, "outputs": true, "inputs": {"n": 4}}, {"idx": 2, "outputs": true, "inputs": {"n": 9}}, {"idx": 3, "outputs": true, "inputs": {"n": 25}}, {"idx": 4, "outputs": true, "inputs": {"n": 36}}, {"idx": 5, "outputs": false, "inputs": {"n": 3}}, {"idx": 6, "outputs": true, "inputs": {"n": 121}}, {"idx": 7, "outputs": false, "inputs": {"n": 14}}, {"idx": 8, "outputs": false, "inputs": {"n": 17}}, {"idx": 9, "outputs": false, "inputs": {"n": 80}}]
question_info.entry_cls_name: Solution