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 | |
namespace App; | |
/** | |
* Brute force version. Will add optimised version later. | |
*/ | |
class Block | |
{ | |
protected $blocks = [ | |
['school'], |
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
class SquatChecker | |
{ | |
public function find(array $domains = null, array $suspects = null): array | |
{ | |
$domains = $domains ?? [ | |
'palantir.com', | |
'apple.com', | |
'nic.ci', | |
]; |
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 | |
/* | |
* Problem: | |
* Given a set of intervals, print all NON overlapping intervals | |
* after merging overlapping intervals. | |
* | |
* Assumptions: | |
* 1. The start of the interval is less than or equal to the end | |
* 2. The input is sorted by the start of the interval in asc order | |
* 3. The intervals are made u of positive integers |