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.
public static String encryption(String s) {
// Write your code here
String code= new String();
s=s.replace(" ", "");
int l=s.length();
double t=Math.sqrt(l);
int r =(int)t;
int c = 0;
if((t-r)==0){c=r;}
else c=r+1;
if(r*c
for(int i=0;i
}
}
code=code+" ";
}
return code;
}
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 →
String code= new String(); s=s.replace(" ", ""); int l=s.length(); double t=Math.sqrt(l); int r =(int)t; int c = 0; if((t-r)==0){c=r;} else c=r+1; if(r*c
for(int i=0;i
} return code; }