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.
Yea something like that. The main logic is first find out the square root of length of the string. Then round of the square root value. Then take a loop upto the round of value and take an inner loop where you will append the result characters by jumping the round of value.
Eg: hihowareyou. This string has 11 characters. Now its square root is 3.3166.... now if we round of this values are it will be 4. So the maximum no of append will be 4
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 →
Yea something like that. The main logic is first find out the square root of length of the string. Then round of the square root value. Then take a loop upto the round of value and take an inner loop where you will append the result characters by jumping the round of value. Eg: hihowareyou. This string has 11 characters. Now its square root is 3.3166.... now if we round of this values are it will be 4. So the maximum no of append will be 4