public void FindsKClosestPoints()
        {
            var input   = new int[][] { new [] { 1, 4 }, new[] { 2, 3 }, new[] { 5, 6 }, new[] { 1, 7 } };
            var closest = KClosestPointsToOrigin.GetKClosest(input, 2);

            Assert.Equal(new int[][] { new[] { 2, 3 }, new[] { 1, 4 } }, closest);
        }
        public void DealsWithEmptyInputs()
        {
            var closestOne = KClosestPointsToOrigin.GetKClosest(new int[, ] {
            }, 2);
            var closestTwo = KClosestPointsToOrigin.GetKClosest(new int[][] { }, 2);

            Assert.Empty(closestOne);
            Assert.Empty(closestTwo);
        }
        public void KclosetToOrigin()
        {
            int[]   p     = { 1, 3 };
            int[]   q     = { -2, 2 };
            int[][] array = new int[][] { p, q };

            KClosestPointsToOrigin KClosetPointsToOrigin = new KClosestPointsToOrigin();

            KClosetPointsToOrigin.KClosest(array, 1);
        }
        public void FindsKClosestPointsUsing2DArray()
        {
            var input = new int[, ] {
                { 1, 4 }, { 2, 3 }, { 5, 6 }, { 1, 7 }
            };
            var closest = KClosestPointsToOrigin.GetKClosest(input, 2);

            Assert.Equal(new int[, ] {
                { 2, 3 }, { 1, 4 }
            }, closest);
        }
        public void Test01()
        {
            var points = new List <(int X, int Y)> {
                (-2, -4), (0, -2), (-1, 0), (3, -5), (-2, -3), (3, 2)
            };
            var results   = KClosestPointsToOrigin.Find(points, 3).ToList();
            var xyResults = results.Select(result => (result.X, result.Y)).OrderBy(x => x.Item1).ThenBy(x => x.Item2).ToList();

            Assert.AreEqual(new List <(int X, int Y)> {
                (-2, -3), (-1, 0), (0, -2)
            }, xyResults);
        }