Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php function findMaxForm($strs, $m, $n) { // Inisialisasi tabel DP dengan ukuran..

Decoded Output download

<?php 
 
function findMaxForm($strs, $m, $n) { 
    // Inisialisasi tabel DP dengan ukuran (m+1) x (n+1) 
    $dp = array_fill(0, $m + 1, array_fill(0, $n + 1, 0)); 
 
    // Iterasi untuk setiap string dalam strs 
    foreach ($strs as $s) { 
        $zeros = substr_count($s, '0'); 
        $ones = substr_count($s, '1'); 
 
        // Update tabel DP dari belakang ke depan 
        for ($i = $m; $i >= $zeros; $i--) { 
            for ($j = $n; $j >= $ones; $j--) { 
                $dp[$i][$j] = max($dp[$i][$j], $dp[$i - $zeros][$j - $ones] + 1); 
            } 
        } 
    } 
 
    return $dp[$m][$n]; 
} 
 
// Contoh penggunaan 
$strs = ["10","0","1"]; 
$m = 1; 
$n = 1; 
echo findMaxForm($strs, $m, $n);  // Output: 4 
 
?> 

Did this file decode correctly?

Original Code

<?php

function findMaxForm($strs, $m, $n) {
    // Inisialisasi tabel DP dengan ukuran (m+1) x (n+1)
    $dp = array_fill(0, $m + 1, array_fill(0, $n + 1, 0));

    // Iterasi untuk setiap string dalam strs
    foreach ($strs as $s) {
        $zeros = substr_count($s, '0');
        $ones = substr_count($s, '1');

        // Update tabel DP dari belakang ke depan
        for ($i = $m; $i >= $zeros; $i--) {
            for ($j = $n; $j >= $ones; $j--) {
                $dp[$i][$j] = max($dp[$i][$j], $dp[$i - $zeros][$j - $ones] + 1);
            }
        }
    }

    return $dp[$m][$n];
}

// Contoh penggunaan
$strs = ["10","0","1"];
$m = 1;
$n = 1;
echo findMaxForm($strs, $m, $n);  // Output: 4

?>

Function Calls

None

Variables

None

Stats

MD5 4f6a9237560f22033c3e10769cce0068
Eval Count 0
Decode Time 50 ms