/**
 * Given a matrix and a target number, returns a list of common elements in the matrix.
 *
 * @param matrix The matrix to search through.
 * @param target The number to search for.
 * @return A list containing the common elements found in the matrix.
 */
fun findCommonElements(matrix: List<List<Int>>, target: Int): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (row in matrix) {
        for (num in row) {
            if (num == target) {
                commonElements.add(num)
            }
        }
    }
    return commonElements
}
/**
 * Given a matrix and a target number, returns a list of common elements in the matrix.
 *
 * @param matrix The matrix to search through.
 * @param target The number to search for.
 * @return A list containing the common elements found in the matrix.
 */
fun findCommonElements(matrix: List<List<Int>>, target: Int): List<Int> {
/**
 * Given a matrix and a target number, returns a list of common elements in the matrix.
 *
 * @param matrix The matrix to search through.
 * @param target The number to search for.
 * @return A list containing the common elements found in the matrix.
 */
fun findCommonElements(matrix: List<List<Int>>, target: Int): List<Int> {

    val commonElements = mutableListOf<Int>()
    for (row in matrix) {
        for (num in row) {
            if (num == target) {
                commonElements.add(num)
            }
        }
    }
    return commonElements
}