title: Horners Method Polynomial Evaluation
signature: class Solution {
  
      public long HornersMethodPolynomialEvaluation(List<int> poly, int n, int x) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(long actual, long expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(List<int> poly, int n, int x, long expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                long pred_result = solution_cls.PLACEHOLDER_FN_NAME(poly, n, x); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  new List<int>{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, 10, 8, 
                  73
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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, 
                  292561
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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, 
                  67907758875578
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );
          }
      }
  }
  
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;
  }