[알고리즘] 피보나치수
long long fibonacci(int n) { if(n==0) return 0; if(n==1) return 1; return fibonacci(n-2) + fibonacci(n-1); } int main() { int testCase = 10; long long testAnswer = fibonacci(testCase); cout<<testAnswer; }...
황트루치
long long fibonacci(int n) { if(n==0) return 0; if(n==1) return 1; return fibonacci(n-2) + fibonacci(n-1); } int main() { int testCase = 10; long long testAnswer = fibonacci(testCase); cout<<testAnswer; }...
public String findKim(String[] seoul){ //x에 김서방의 위치를 저장하세요. int x = 0; x = IntStream.range(0, seoul.length) .filter(idx -> seoul[idx].equals(“Kim”)) .findFirst().getAsInt(); return “김서방은 “+ x + “에 있다”; } class Divisible...
JAVA EE로 팩토리 패턴을 구현 public class EventProducer{ @Produces public String getMessage(){ return “메시지입니다”; } } public class EventService{ @Inject private String message; public void startService(){ System.out.println(“서비스 호출::”+message); } }...
public class MySingleton { private static MySingleton instance; private MySingleton(){} public static synchronized MySingleton getInstance(){ // 경합조건 해결을 위해 synchronized 추가 if(instance == null){ instance = new MySingleton(); } return...
Hello KyoBin, Ready for a change? Please meet IntelliJ IDEA 2018.1 – our first major update of this year! This new release brings with it significant improvements to supported languages, frameworks, version...
<!– https://mvnrepository.com/artifact/com.google.guava/guava –> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>24.0-jre</version> </dependency> List<OnlineMenuVO> selectMenu2List = this.uiMainService.selectMenu2List(this.custCoCd); Predicate<OnlineMenuVO> lvl1ListPredicate = new Predicate<OnlineMenuVO>() { @Override public boolean apply(@Nullable OnlineMenuVO onlineMenuVO) { if(onlineMenuVO.getClsLvl() == 1){ return true;...
바이너리 트리 레벨선회 구현하기 Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example: Given binary tree [3,9,20,null,null,15,7], 3 /...
바이너리 트리 후위선회 구현하기 Given a binary tree, return the postorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [3,2,1]. Note: Recursive solution is trivial,...
바이너리 트리 중위순회 구현하기 Given a binary tree, return the inorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could...
바이너리 트리에서 전위순회 구현해보기 Given a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree [1,null,2,3], 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, could...
More
최근 댓글