hashcode-utils-kt / org.hildan.hashcode.utils / solveHCProblemAndWriteFile

solveHCProblemAndWriteFile

inline fun solveHCProblemAndWriteFile(inputFilePath: Path, outputFilePath: Path = computeHCOutputPath(inputFilePath), readAndSolve: HCReader.() -> Iterable<CharSequence>): Unit

Reads the input file at inputFilePath by calling readAndSolve, and writes the returned lines to the file at outputFilePath.

Parameters

inputFilePath - the path to the input file

outputFilePath - the path to the output file (will be overwritten if it exists). By default, the output file is computed from the input filename using computeHCOutputPath.

readAndSolve - a function that reads the problem, solves it, and returns the output lines to write