comefrom: <awangdev>Paint Fence_2.java
code: public int numWays(int n, int k) {
          if (n <= 1 || k <= 0) {
              return n * k;
          }
          int[] dp = new int[3];
          dp[0] = 0;
          dp[1] = k;
          dp[2] = k + k * (k - 1);
          
          for (int i = 3; i <= n; i++) {
              dp[i % 3] = (k - 1) * (dp[(i - 1) % 3] + dp[(i - 2) % 3]);
          }
          
          return dp[n % 3];
      }
masked: public int sample_funcname ( int var_0 , int var_1 ) {
    if ( var_0 <= 1 || var_1 <= 0 ) {
      return var_0 * var_1 ;
    }
    int [ ] var_2 = new int [ 3 ] ;
    var_2 [ 0 ] = 0 ;
    var_2 [ 1 ] = var_1 ;
    var_2 [ 2 ] = var_1 + var_1 * ( var_1 - 1 ) ;
    for ( int var_3 = 3 ;
    var_3 <= var_0 ;
    var_3 ++ ) {
      var_2 [ var_3 % 3 ] = ( var_1 - 1 ) * ( var_2 [ ( var_3 - 1 ) % 3 ] + var_2 [ ( var_3 - 2 ) % 3 ] ) ;
    }
    return var_2 [ var_0 % 3 ] ;
  }
  