You are viewing a single comment's thread. Return to all comments →
My solution:
let space = Character(" ") let char = Character("#") var spaceCount = 0 var charCount = 0 for (var i = 0; i<n; i++) { spaceCount = n-1-i charCount = i+1 let spaceString = String(count: spaceCount, repeatedValue: space) let charString = String(count: charCount, repeatedValue: char) print("\(spaceString)\(charString)") }
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 →
My solution: