public void GivenICanChooseFromTheseSkyConditions(Table table)
 {
     foreach (var row in table.Rows)
     {
         Sky.Add(row[1], byte.Parse(row[0]));
     }
 }
        public IList <int[]> GetSkyline(int[,] buildings)
        {
            var ret = new List <int[]>();
            var sky = new Sky();

            for (int i = 0; i < buildings.GetLength(0); i++)
            {
                while (sky.Count > 0 && sky.MinX < buildings[i, 0])
                {
                    int x = sky.MinX;
                    int y = sky.Remove();
                    if (y > sky.MaxY)
                    {
                        ret.Add(new int[] { x, sky.MaxY });
                    }
                }
                if (ret.Count > 0 && buildings[i, 0] == ret[ret.Count - 1][0]) // same x
                {
                    ret[ret.Count - 1][1] = Math.Max(ret[ret.Count - 1][1], buildings[i, 2]);
                }
                else if (ret.Count == 0 || buildings[i, 2] > ret[ret.Count - 1][1]) // a new higher y
                {
                    ret.Add(new int[] { buildings[i, 0], buildings[i, 2] });
                }
                sky.Add(buildings[i, 1], buildings[i, 2]); // add the ending of this building
            }

            while (sky.Count > 0)
            {
                int x = sky.MinX;
                int y = sky.Remove();
                if (y > sky.MaxY)
                {
                    ret.Add(new int[] { x, sky.MaxY });
                }
            }

            return(ret);
        }