This file contains hidden or 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
<html> | |
<head> | |
<style> | |
body{ | |
display: flex; | |
flex-direction: column; | |
justify-content: center; | |
} | |
.container{ |
This file contains hidden or 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
//assumes that you have installed PHPAlgorithms properly: | |
//https://github.com/doganoo/PHPAlgorithms | |
$arr = [1, 2, 3, 4, 5, 6, 7, 8]; | |
echo secondHighest($arr); //echo's 7 | |
function secondHighest(array $array): int { | |
$maxHeap = new MaxHeap(); | |
foreach ($array as $value) { | |
$maxHeap->insert($value); |
This file contains hidden or 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 flood(array &$matrix, int $i, int $j) { | |
$matrix[$i][$j] = 0; | |
lookupFor($matrix, $i + 1, $j); | |
lookupFor($matrix, $i, $j + 1); | |
lookupFor($matrix, $i - 1, $j); | |
lookupFor($matrix, $i, $j - 1); | |
} |
This file contains hidden or 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 | |
$loggggggggger = function ($message): void { | |
if (is_array($message)) $message = print_r($message, true); | |
if (is_bool($message)) $message = $message ? "true" : "false"; | |
if ($message instanceof \Exception) $message = $message->getTraceAsString(); | |
$dateTime = (new \DateTime())->format("Y-m-d H:i:s"); | |
file_put_contents("/var/log/application.log", "$dateTime : $message\n\n\n\n", FILE_APPEND); | |
}; |
This file contains hidden or 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 | |
use doganoo\PHPAlgorithms\Datastructure\Sets\HashSet; | |
use doganoo\PHPAlgorithms\Datastructure\Stackqueue\Queue; | |
require_once 'vendor/autoload.php'; | |
/* | |
* COMPOSER.JSON CONTENT: | |
* ================================================== |
This file contains hidden or 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
var=1 | |
# File source am Mac | |
# for file in /Users/dogano/Desktop/new/brazil.xcf | |
# File source Linux | |
for file in /home/dogano/Schreibtisch/flags_origin/*.svg | |
do | |
echo $file |
This file contains hidden or 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 numIslands(array $grid):int { | |
$length = count($grid); | |
$islandCount = 0; | |
if ($length === 0) { | |
return 0; | |
} | |
for ($i = 0; $i < $length; $i++) { |