using System.Collections.Generic;
public static int[] GetNumOrdinalsThatSumToTarget(int[] nums, int target)
int[] resultOrdinals = new int[2];
public static void Main()
Console.WriteLine("Appriss Retail - Ordinal Sums");
Console.WriteLine("Appriss Retail - Ordinal Sums");
int[] nums = new int[] { 2, 7, 11, 15 };
int[] result1 = GetNumOrdinalsThatSumToTarget(nums, 18);
if (result1?.Length != 2)
throw new Exception("Two Results Expected");
if (result1[0] != 1 && result1[1] != 2)
throw new Exception("Invalid result for target 18");
int[] result2 = GetNumOrdinalsThatSumToTarget(nums, 22);
if (result2?.Length != 2)
throw new Exception("Two Results Expected");
if (result2[0] != 1 && result2[1] != 3)
throw new Exception("Invalid result for target 22");
GetNumOrdinalsThatSumToTarget(nums, int.MaxValue);
Console.WriteLine("Call 3 DID NOT throw an exception as expected.");
Console.WriteLine($"Call 3 failed, as expected, with error: {e.Message}");