We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
육안으로 저장된 값들을 확인하면서 동작원리를 생각해보면 이해에 도움이 될 것 같아 간단하게 만들어 봤습니다. 책 너무 잘보고 있습니다. `package DynamicProgramming;
import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors;
public class Fibonacci_ImprovedRecursive { public static long[] savedValue = new long[100];
public static long fibo(int x){ if(x==1||x==2){ return 1; } if(savedValue[x]!=0){ return savedValue[x]; }else { savedValue[x]=fibo(x-1)+fibo(x-2); return fibo(x-1)+fibo(x-2); } } public static void main(String[] args) { List<Long> saveLongValue; try { while (true) { Scanner sc = new Scanner(System.in); System.out.println("피보나치 항을 입력하시오>>"); int s = sc.nextInt(); fibo(s); System.out.println("배열에 저장된 값>>"); saveLongValue = Arrays.stream(savedValue).filter(i -> i != 0).boxed().collect(Collectors.toList()); System.out.println(saveLongValue); } }catch (Exception e){ e.printStackTrace(); } }
} `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
육안으로 저장된 값들을 확인하면서 동작원리를 생각해보면 이해에 도움이 될 것 같아 간단하게 만들어 봤습니다. 책 너무 잘보고 있습니다.
`package DynamicProgramming;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Fibonacci_ImprovedRecursive {
public static long[] savedValue = new long[100];
}
`
The text was updated successfully, but these errors were encountered: