8 lines scala disjoint-set / union-find solution
```scala []
object Solution {
  import scala.util.chaining._
  def numberOfComponents(properties: Array[Array[Int]], k: Int): Int = {
    val djs = properties.indices.to(Array)
    def root(i:Int): Int = if(djs(i)==i) i else root(djs(i)).tap(djs(i) = _)
    def join(i:Int)(j:Int) = (djs(root(j))=root(i))
    properties.map(_.to(Set)).to(List).zipWithIndex.tails.filter(_.nonEmpty)
      .flatMap{t => t.head pipe {case (aSet,i) =>
          t.tail.collect{ case (bSet,j) if (aSet intersect bSet).size >= k => (i,j)}
      }}.foreach{case (i,j) => join(i)(j)}
    djs.indices.map(root).distinct.size
  }
}
```
['Hash Table', 'Greedy', 'Union Find', 'Graph', 'Scala']