You are viewing a single comment's thread. Return to all comments →
Thank you for the hint. O(s.Length)
string s = Console.ReadLine().Trim(); var rowLength = (int)Math.Sqrt(s.Length)+1; if(Math.Sqrt(s.Length)-(int)Math.Sqrt(s.Length) == 0) rowLength = (int)Math.Sqrt(s.Length); for(int index = 0; index < rowLength;index++){ var verticalStrip = string.Empty; var k = index; while( k < s.Length){ verticalStrip += s[k]; k += rowLength; } Console.Write(verticalStrip+ " "); }
Encryption
You are viewing a single comment's thread. Return to all comments →
Thank you for the hint. O(s.Length)