Skip to content

Instantly share code, notes, and snippets.

@hilda8519
Created August 20, 2014 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hilda8519/64d908e42fae1ac7a8e1 to your computer and use it in GitHub Desktop.
Save hilda8519/64d908e42fae1ac7a8e1 to your computer and use it in GitHub Desktop.
package numberofways;
public class numberofways {
public static int numberways(int n){
if(n<0){
return 0;
}
if(n==0){
return -1;
}
else{
return numberways(n-1)+numberways(n-2)+numberways(n-3);
}
}
public static void main(String[] args){
System.out.println(numberways(100));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment