title: Horners Method Polynomial Evaluation
signature: class Solution {
  
      public Long hornersMethodPolynomialEvaluation(ArrayList<Integer> poly, Integer n, Integer x) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(ArrayList<Integer> poly, Integer n, Integer x, Long expected){
          try{
              Driver driver = new Driver();
              if (driver.run(poly, n, x,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1)), 10, 8, 73L);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), 20, 23, 292561L);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(new ArrayList<>(Arrays.asList(86, 62, 30, 27, 98, 75, 93, 37, 70, 16, 20, 74, 46, 74, 25, 59, 86, 32, 17, 90, 80, 10, 17)), 12, 12, 67907758875578L);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(ArrayList<Integer> poly, Integer n, Integer x, Long expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(poly, n, x),expected);
      }
      
      public boolean validateSolution(Long actual, Long expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def horners_method_polynomial_evaluation(poly, n, x):
      result = poly[0]
      for i in range(1, n):
          result = ((result * x) + poly[i])
      return result
source_cpp: int horners_method_polynomial_evaluation(vector<int> poly, int n, int x) {
    int result = poly [ 0 ];
    for ( int i = 1;
    i < n;
    i ++ ) result = result * x + poly [ i ];
    return result;
  }