title: Number Ways Node Make Loop Size K Undirected Complete Connected Graph N Nodes
signature: def numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes(n: Int, k: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Float , expected: Float): Boolean = {
      (actual - expected).abs < 1e-06F
  }
  
  def driver(n: Int, k: Int, expected: Float): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(n, k),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        16, 2, 
        15.0F    
      )}")   
  
  }
  
source_py: def number_ways_node_make_loop_size_k_undirected_complete_connected_graph_n_nodes(n, k):
      p = 1
      if (k % 2):
          p = (- 1)
      return ((pow((n - 1), k) + (p * (n - 1))) / n)
source_cpp: int number_ways_node_make_loop_size_k_undirected_complete_connected_graph_n_nodes(int n, int k) {
    int p = 1;
    if ( k % 2 ) p = - 1;
    return ( pow ( n - 1, k ) + p * ( n - 1 ) ) / n;
  }