/**
 * A carpenter needs to calculate the length of a board required for a rectangular frame. She knows the
 * dimensions of the frame, as well as the maximum length of a single board available. Use modulus and
 * comparison with other values to create a function that returns the minimum number of boards the
 * carpenter needs.
 *
 * @param length The length of the frame in inches.
 * @param width The width of the frame in inches.
 * @return The minimum number of boards required to build the frame.
 */
fun calculateBoardLength(length: Int, width: Int): Int {

    val maxBoardLength = 96   // Assuming maximum board length is 8 feet (96 inches)

    if (length < 1 || width < 1) {
        return -1  // Invalid frame dimensions
    }

    val totalLengthNeeded = 2 * length + 2 * width

    if (maxBoardLength % totalLengthNeeded == 0) {
        return maxBoardLength / totalLengthNeeded   // Complete solution
    }

    val completeBoardsNeeded = maxBoardLength / totalLengthNeeded
    val remainingLength = maxBoardLength % totalLengthNeeded

    if (remainingLength < length || remainingLength < width) {
        return completeBoardsNeeded + 1
    }

    return completeBoardsNeeded
}
/**
 * A carpenter needs to calculate the length of a board required for a rectangular frame. She knows the
 * dimensions of the frame, as well as the maximum length of a single board available. Use modulus and
 * comparison with other values to create a function that returns the minimum number of boards the
 * carpenter needs.
 *
 * @param length The length of the frame in inches.
 * @param width The width of the frame in inches.
 * @return The minimum number of boards required to build the frame.
 */
fun calculateBoardLength(length: Int, width: Int): Int {
/**
 * A carpenter needs to calculate the length of a board required for a rectangular frame. She knows the
 * dimensions of the frame, as well as the maximum length of a single board available. Use modulus and
 * comparison with other values to create a function that returns the minimum number of boards the
 * carpenter needs.
 *
 * @param length The length of the frame in inches.
 * @param width The width of the frame in inches.
 * @return The minimum number of boards required to build the frame.
 */
fun calculateBoardLength(length: Int, width: Int): Int {

    val maxBoardLength = 96   // Assuming maximum board length is 8 feet (96 inches)

    if (length < 1 || width < 1) {
        return -1  // Invalid frame dimensions
    }

    val totalLengthNeeded = 2 * length + 2 * width

    if (maxBoardLength % totalLengthNeeded == 0) {
        return maxBoardLength / totalLengthNeeded   // Complete solution
    }

    val completeBoardsNeeded = maxBoardLength / totalLengthNeeded
    val remainingLength = maxBoardLength % totalLengthNeeded

    if (remainingLength < length || remainingLength < width) {
        return completeBoardsNeeded + 1
    }

    return completeBoardsNeeded
}