title: Number Ways Node Make Loop Size K Undirected Complete Connected Graph N Nodes
signature: class Solution {
  
      public Float numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes(Integer n, Integer k) {
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;
  }
question_info.extension: java
question_info.entry_fn_name: numberWaysNodeMakeLoopSizeKUndirectedCompleteConnectedGraphNNodes
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 15.0, "inputs": {"n": 16, "k": 2}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer n, Integer k, Float expected){
          try{
              Driver driver = new Driver();
              if (driver.run(n, k,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(16, 2, 15.0f);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer n, Integer k, Float expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(n, k),expected);
      }
      
      public boolean validateSolution(Float actual, Float expected){
          return Math.abs(actual - expected) < 1e-06f;
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0
question_info.commands: java __FILENAME__