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.
Need to calculate the width of a row, which is not only stars, but also spaces. Each level adds one more star-space pair, so each level grows by 2 in width. See also docs of rpad function.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Draw The Triangle 1
You are viewing a single comment's thread. Return to all comments →
Need to calculate the width of a row, which is not only stars, but also spaces. Each level adds one more star-space pair, so each level grows by 2 in width. See also docs of
rpad
function.