Skip to content

Instantly share code, notes, and snippets.

<?php
namespace App;
/**
* Brute force version. Will add optimised version later.
*/
class Block
{
protected $blocks = [
['school'],
@jeromefitzpatrick
jeromefitzpatrick / squat.php
Last active February 3, 2021 06:58
Who squatting deh so?
class SquatChecker
{
public function find(array $domains = null, array $suspects = null): array
{
$domains = $domains ?? [
'palantir.com',
'apple.com',
'nic.ci',
];
<?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