Sort by

recency

|

70 Discussions

|

  • + 0 comments

    It’s such a helpful way to start understanding the core ideas—like how pure functions behave, and why immutability matters. 11 x play

  • + 0 comments

    Discover premium car rental services with Royals Rent a Car Lahore. From luxury vehicles like Land Cruisers, Fortuners, and limousines to affordable intercity travel. Royal Motors

  • + 0 comments

    Functions are a must if you want clean, reusable code! When we worked on reelit com, they saved us tons of time by keeping everything organized and efficient.

  • + 0 comments

    When looking at a set of ordered pairs, Lead Generation Accountants may consider whether each unique value in the domain maps to a single value in the range to determine if it's a valid function. For each test case, check that no domain value repeats.

  • + 0 comments

    Scala: given x -> f(x), if x1 = x2 then f(x1) = f(x2), if f(x1) != f(x2), it is not a function. This is the code in scala:

    import scala.io.StdIn
    
    object Solution {
    
        def main(args: Array[String]) {
            /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution
    */
            var count_tests = StdIn.readInt
                
            for(j <- List.range(0,count_tests)){
                var input = StdIn.readInt
                var relations = collection.mutable.Map[Int, Int]()
                var result = true
                                        
                for(i <- List.range(0,input)){
                    var test_arr = StdIn.readLine()
                    var test1 = test_arr.split(" ")(0).toInt
                    var test2 = test_arr.split(" ")(1).toInt
                    
                    if (!relations.contains(test1)) 
                        relations = relations + (test1 -> test2)
                    else {
                        if(relations(test1) != test2)
                            result = false                    
                    }
                        
                }
                if(result)
                    println("YES")
                else
                    println("NO")
            }
        }
    }