This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fupfin.euler.problem2 | |
import scala.collection.immutable.Stream._ | |
import scala.collection.GenIterable | |
object Problem2 { | |
def fib(max: Int): Stream[Int] = 1 #:: 2 #:: fib(1, 2, max) | |
private def fib(v1:Int, v2:Int, max:Int): Stream[Int] = if(v1 + v2 <= max) (v1 + v2) #:: fib(v2, v1 + v2, max) else Empty | |
def sum(that:GenIterable[Int], p: Int => Boolean): Int = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.fupfin.insight.evnet2b; | |
import java.util.LinkedList; | |
import java.util.List; | |
import org.fupfin.insight.evnet2b.WordGraphBuilder.WordGraph; | |
public abstract class AbstractPathFinder implements PathFinder { | |
protected WordGraph graph; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.fupfin.insight.event2a; | |
public interface FactorialZeroTailCounter { | |
/** | |
* n!의 결과에서 뒷부분 0의 개수와 그 앞자리 수의 수를 반환한다. | |
* @param n 팩토리얼을 계산하려는 수 | |
* @return 끝자리 0의 개수와 그 앞자리 수 | |
*/ | |
public Result count(int n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.fupfin.insight.event1b; | |
import java.util.Arrays; | |
import java.util.concurrent.RecursiveAction; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.concurrent.ForkJoinPool; | |
public class SetPartitioner { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.fupfin.insight.event1; | |
import java.lang.reflect.Array; | |
public abstract class AbstractArrayRotator<T> implements ArrayRotator<T>{ | |
@Override | |
public T[] rotateRight(T[] source, int step) { | |
if(isValidArguments(source, step)) | |
throw new IllegalArgumentException("step value have to be not negative number : " + step); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fupfin; | |
public class Tuples { | |
private Tuples() {} | |
public static <T1, T2> Tuple2<T1, T2> tuple(T1 v1, T2 v2) { | |
return new Tuple2<T1, T2>(v1, v2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fupfin; | |
import java.util.NoSuchElementException; | |
/** | |
* A base class of simple value container that represents optional values. You can | |
* use subclass Some<A> for some existent values or None for non existent values. | |
* This is java version of scala Option class. | |
* | |
* @author fupfin@gmail.com |
NewerOlder