Skip to content

Instantly share code, notes, and snippets.

@kemalkanok
Created December 9, 2015 14:12
Show Gist options
  • Save kemalkanok/cb999f6b2b1ea163aaba to your computer and use it in GitHub Desktop.
Save kemalkanok/cb999f6b2b1ea163aaba to your computer and use it in GitHub Desktop.
php trial
<?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