Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
1.2 kB
4
Indexable
Never
class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var res = new List<int[]>();
            // Test 1
            res = ThreeSum(new int[] {-1, 1, 1, 0, -1, 2, 0, 1, 3, -1, -2});

            // Test 2
            //res = ThreeSum(new int[] {4, -2, -5, 3, 1, 7, 0, 7, -2, 4, -1, -1});

            // Test 3
            //res = ThreeSum(new int[] { });

            // Test 4
            //res = ThreeSum(null);

            Print(res);
        }

        private static void Print(List<int[]> res)
        {
            if (res != null)
            {
                Console.WriteLine("The results:");
                foreach (var r in res)
                {
                    Console.WriteLine($"{r[0]},{r[1]},{r[2]}");
                }
            }
            else
            {
                Console.WriteLine("Empty or null result.");
            }
        }

        public static List<int[]> ThreeSum(int[] arr)
        {
            var retVal = new List<int[]>();
            
            // Add logic here

            return retVal;
        }
    }