title: Subset Sum Divisible M
signature: function subsetSumDivisibleM(arr, n, m) {
source_py: def subset_sum_divisible_m(arr, n, m):
      if (n > m):
          return True
      DP = [False for i in range(m)]
      for i in range(n):
          if DP[0]:
              return True
          temp = [False for i in range(m)]
          for j in range(m):
              if (DP[j] == True):
                  if (DP[((j + arr[i]) % m)] == False):
                      temp[((j + arr[i]) % m)] = True
          for j in range(m):
              if temp[j]:
                  DP[j] = True
          DP[(arr[i] % m)] = True
      return DP[0]
source_cpp: bool subset_sum_divisible_m(vector<int> arr, int n, int m) {
    if ( n > m ) return true;
    bool DP [ m ];
    memset ( DP, false, m );
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( DP [ 0 ] ) return true;
      bool temp [ m ];
      memset ( temp, false, m );
      for ( int j = 0;
      j < m;
      j ++ ) {
        if ( DP [ j ] == true ) {
          if ( DP [ ( j + arr [ i ] ) % m ] == false ) temp [ ( j + arr [ i ] ) % m ] = true;
        }
      }
      for ( int j = 0;
      j < m;
      j ++ ) if ( temp [ j ] ) DP [ j ] = true;
      DP [ arr [ i ] % m ] = true;
    }
    return DP [ 0 ];
  }