/**
 * This function takes in two lists representing number line representations and returns the common elements between them.
 *
 * @param nums1 A list representing the first number line representation
 * @param nums2 A list representing the second number line representation
 * @return A list containing the common elements between nums1 and nums2
 *
 * Example:
 * findCommonElements(listOf(-10, -5, 0, 5, 10), listOf(-10, -7, 0, 3, 10)) => listOf(-10, 0, 10)
 */
fun findCommonElements(nums1: List<Int>, nums2: List<Int>): List<Int> {

    // Convert the lists to sets for easier manipulation
    val set1 = nums1.toSet()
    val set2 = nums2.toSet()

    // Find the intersection of the two sets
    val intersection = set1.intersect(set2)

    // Sort the elements in ascending order and convert it back to a list
    val commonElements = intersection.sorted()

    return commonElements
}
/**
 * This function takes in two lists representing number line representations and returns the common elements between them.
 *
 * @param nums1 A list representing the first number line representation
 * @param nums2 A list representing the second number line representation
 * @return A list containing the common elements between nums1 and nums2
 *
 * Example:
 * findCommonElements(listOf(-10, -5, 0, 5, 10), listOf(-10, -7, 0, 3, 10)) => listOf(-10, 0, 10)
 */
fun findCommonElements(nums1: List<Int>, nums2: List<Int>): List<Int> {
/**
 * This function takes in two lists representing number line representations and returns the common elements between them.
 *
 * @param nums1 A list representing the first number line representation
 * @param nums2 A list representing the second number line representation
 * @return A list containing the common elements between nums1 and nums2
 *
 * Example:
 * findCommonElements(listOf(-10, -5, 0, 5, 10), listOf(-10, -7, 0, 3, 10)) => listOf(-10, 0, 10)
 */
fun findCommonElements(nums1: List<Int>, nums2: List<Int>): List<Int> {

    // Convert the lists to sets for easier manipulation
    val set1 = nums1.toSet()
    val set2 = nums2.toSet()

    // Find the intersection of the two sets
    val intersection = set1.intersect(set2)

    // Sort the elements in ascending order and convert it back to a list
    val commonElements = intersection.sorted()

    return commonElements
}