/**
 * Given two lists, find the common elements using the 'in' statement and a comparison operator (less than).
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list of common elements found in both input lists.
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * commonElements(listOf(7, 8, 9), listOf(1, 2, 3)) // []
 *
 * Note:
 * - The elements should be compared using the '<' operator.
 * - The input lists can contain duplicate elements.
 * - The result list should not contain any duplicate elements.
 * - The order of elements in the result list does not matter.
 */
fun commonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val common = mutableListOf<Int>()

    for (item1 in list1) {
        for (item2 in list2) {
            if (item1 < item2 && item1 !in common) {
                common.add(item1)
            }
        }
    }

    return common
}
/**
 * Given two lists, find the common elements using the 'in' statement and a comparison operator (less than).
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list of common elements found in both input lists.
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * commonElements(listOf(7, 8, 9), listOf(1, 2, 3)) // []
 *
 * Note:
 * - The elements should be compared using the '<' operator.
 * - The input lists can contain duplicate elements.
 * - The result list should not contain any duplicate elements.
 * - The order of elements in the result list does not matter.
 */
fun commonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists, find the common elements using the 'in' statement and a comparison operator (less than).
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return A list of common elements found in both input lists.
 *
 * Example:
 * commonElements(listOf(1, 2, 3, 4), listOf(3, 4, 5, 6)) // [3, 4]
 * commonElements(listOf(7, 8, 9), listOf(1, 2, 3)) // []
 *
 * Note:
 * - The elements should be compared using the '<' operator.
 * - The input lists can contain duplicate elements.
 * - The result list should not contain any duplicate elements.
 * - The order of elements in the result list does not matter.
 */
fun commonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val common = mutableListOf<Int>()

    for (item1 in list1) {
        for (item2 in list2) {
            if (item1 < item2 && item1 !in common) {
                common.add(item1)
            }
        }
    }

    return common
}