We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I went with StringBuilder too! in C#. Care more about performance than shorter code (though shorter is usually sweeter), which string builder is doing for both of us =]...
int n = Convert.ToInt32(Console.ReadLine());
//Solution.
StringBuilder floor = new StringBuilder(n*n);
for(int i = 1; i < n + 1; i++)
{
floor.Append(' ', n - i);
floor.Append('#', i);
if(n != i) floor.Append(Environment.NewLine);
}
Console.WriteLine(floor);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
I went with StringBuilder too! in C#. Care more about performance than shorter code (though shorter is usually sweeter), which string builder is doing for both of us =]...