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.
int l = s.length();
int r = floor(sqrt(l));
int c = ceil(sqrt(l));
//To store each column successively
string culmnstring[c];
// The string to return
string lastr;
for (int i = 0; i < c; i++)
{
for (int j = 0; j + i < l; j+= c)
{
if (isalpha(s[j + i]) == 0)
{
continue;
}
columnstring[i] += s[j + i];
}
if (i != c - 1)
{
lastr += clumnstring[i] + ' ';
}
else
{
lastr += columnstring[i];
}
}
return lastr;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →
cpp code:
string encryption(string s) {
}