- Recursion 알고리즘 : 모든 리커젼은 아래 틀을 이용한다. : 아래 틀을 이용해서 리커젼 문제들을 연습하자. if ( 종료 조건 ) return 종료 값 else if ( 또 다른 종료 조건 ) return 또 다른 종료 값 else return ( 몇 가지 작업 ) and then ( 재귀 호출 ) : 모든 리커젼 기법은 반복문으로 작성할 수 있다. - 재귀 vs 반복 (1) 일반적으로 반복 방식이 재귀보다 성능면에서 효율적이다. ( 재귀 방식은 함수 호출의 오버헤드가 크다. ) (2) 그럼에도 재귀를 쓰는 이유는 몇몇 문제에서 명확한 반복 알고리즘이 존재하지 않을 수 있다. 또한 몇몇 문제에서 반복적인 방법들 보다 재귀적인 해결책이 가장 적합할 수 있다. (3) 재귀 코드는 반복 코드보다 ..
https://www.codewars.com/kata/5765870e190b1472ec0022a2/java Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com Task You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). Return true if you ..
https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1/java Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com Snail Sort Given an n x n array, return the array elements arranged from outermost elements to the middle element, traveling clockwise. array = [[1,2,3], [4,..
https://www.codewars.com/kata/5672682212c8ecf83e000050/java Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com Consider a sequence u where u is defined as follows: The number u(0) = 1 is the first one in u. For each x in u, then y = 2 * x + 1 and z = 3 * x + 1 must be..
https://www.codewars.com/kata/51c8e37cee245da6b40000bd/java Codewars: Train your coding skills Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential. www.codewars.com Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be..