Sort by

recency

|

66 Discussions

|

  • + 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")
            }
        }
    }
    
  • + 0 comments

    Understanding the duties and responsibilities of real estate professionals is crucial in navigating the intricacies of property transactions. This informative article has proven to be an invaluable guide, illuminating essential aspects that will undoubtedly empower me to make informed decisions when embarking on the journey of purchasing a new home. I am genuinely appreciative of the insights it provides, elevating my confidence and knowledge in the real estate market. For additional details, especially pertaining to the use of flange in real estate.

  • + 0 comments

    The discussion on whether certain functions are essential in the real estate industry greatly resonates with my interests as a prospective homebuyer. Knowing the role and responsibilities of realtors is pivotal in navigating the complex world of property transactions. This article has proven to be an invaluable resource, shedding light on critical aspects that will undoubtedly aid me in making well-informed choices when it comes to purchasing a new home. I'm truly grateful for the insights it has offered, making my journey in the real estate market a more informed and confident one.for more information https://www.topdogslandscape.com/pressure-washing-ayden-nc/.

  • + 0 comments

    As a real estate enthusiast, I find the topic Functions or Not? intriguing and relevant to my interests as a potential homebuyer. Understanding the functions of realtors is crucial in the property market, especially when searching for properties click here. I appreciate the valuable insights provided in this article, guiding me towards informed decisions.

  • + 1 comment

    F# solution with pipes

    open System
    
    let readDomain n =
        [ 1..n ]
        |> List.map (fun _ -> (Console.ReadLine().Split ' ').[0])
    
    let validate domain =
        domain
        |> List.distinct
        |> List.length
        |> (=) (List.length domain)
    
    [<EntryPoint>]
    let main argv =
        let t = Console.ReadLine() |> int
    
        [ 1..t ]
        |> List.iter (fun _ ->
            Console.ReadLine()
            |> int
            |> readDomain
            |> validate
            |> (fun isValid -> if isValid then "YES" else "NO")
            |> Console.WriteLine)
    
        0