Created
December 9, 2015 14:12
-
-
Save kemalkanok/cb999f6b2b1ea163aaba to your computer and use it in GitHub Desktop.
php trial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dispay($arr,$n) | |
{ | |
for ($i=0; $i < $n; $i++) { | |
for ($j=0; $j < $j; $j++) { | |
echo $arr[$i][$j]; | |
} | |
} | |
} | |
function min($arr,$n) | |
{ | |
$min = 123123213213; | |
$loc = [0,0] | |
for ($i=0; $i < $n; $i++) { | |
for ($j=0; $j < $j; $j++) { | |
if($min > $arr[$i][$j]) | |
{ | |
$min = $arr[$i][$j]; | |
$loc = [$i,$j]; | |
} | |
} | |
} | |
return $loc; | |
} | |
$arr = [ | |
[1,2,3], | |
[4,5,6], | |
[7,8,9] | |
]; | |
$n = 3 | |
$k = 7; | |
for ($i=0; $i < $k; $i++) { | |
$loc = min($arr,$n); | |
$arr[$loc[0]][$loc[1]]++; | |
} | |
display($arr,$n); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment