BootCamp 25day

GyeongNamΒ·2023λ…„ 12μ›” 25일
0

BootCamp

λͺ©λ‘ 보기
23/49
post-thumbnail

πŸ“… 2023λ…„ 12μ›” 18일

[java 10일차]
μ§‘μ•ˆμ‚¬μ • λ•Œλ¬Έμ— κΈ‰ν•˜κ²Œ νœ΄κ°€μ‚¬μš©ν•œ 날이닀.
λ°‘ μ •λ¦¬λ‚΄μš©μ€ 같은 κ΅μœ‘μƒμ—κ²Œ λ°›μ•„ λ”°λ‘œ μ •λ¦¬ν–ˆλ‹€.


25일차: java 심화(3)

μž¬κ·€ν•¨μˆ˜

λ©”μ†Œλ“œκ°€ μžκΈ°μžμ‹ μ„ ν˜ΈμΆœν•˜λŠ” λ©”μ„œλ“œλ₯Ό μž¬κ·€ν•¨μˆ˜λΌ ν•œλ‹€. μ΄λŸ¬ν•œ ν˜ΈμΆœλ°©μ‹μ„ μž¬κ·€ν˜ΈμΆœμ΄λΌκ³  ν•œλ‹€.

int[] fibonacchi1 = new int [10];
int first = 1;
int second = 1;
for(int i = 2; i < 10; i++){
	int third = first + second;
	first = second;
	second = third;
    System.out.print(third + " ");
}
System.out.println(fibonacci(10));
static int fibonacci (int n){
    if(n <= 1){
        return  1;
    } else{
        return fibonacci(n-1) + fibonacci(n-2);
    }
}
static void combination(
	List<Integer> myList1 , 
    List<List<Integer>> combinations1, 
    List<Integer> temp1,  
    int n, 
    int start
){
    if(temp1.size() == n){
    	combinations1.add(new ArrayList<>(temp1));
        return;
    }
	for (int i = start; i < myList1.size(); i++) {
        temp1.add(myList1.get(i));
        combination(myList1, combinations1, temp1, n, i+1);
        temp1.remove(temp1.size()-1);
	}
}

github java μ‹€μŠ΅ λ‚΄μš©

profile
503 Service Unavailable Error

0개의 λŒ“κΈ€