Skip to content

Instantly share code, notes, and snippets.

@frhan
Last active August 18, 2020 19:47
Show Gist options
  • Save frhan/6065e73d669dce7e9da5731ce30f6f03 to your computer and use it in GitHub Desktop.
Save frhan/6065e73d669dce7e9da5731ce30f6f03 to your computer and use it in GitHub Desktop.
package me.ff.jtest;
public class Test2 {
static void solution(int n){
String [] result = new String[n+1];
for (int i=1;i<=n; i++){
result[i] = "";
}
for(int i=2; i<=n; i=i+2){
result[i] = "Codility";
}
for(int i=3; i<=n; i=i+3){
result[i] = result[i]+"Test";
}
for(int i=5; i<n; i=i+5){
result[i] = result[i]+"Coder";
}
for (int i=1; i<=n;i++){
if(!result[i].equals("")){
System.out.println(result[i]);
continue;
}
System.out.println(i);
}
}
public static void main(String [] args){
solution(24);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment