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 solution($X, $A) { | |
foreach ($A as $key => $value) { | |
$part1 = array_slice($A, 0, $key); | |
$part2 = array_slice($A, $key, count($A) - 1); | |
$arrayPart1Indexes = array(); | |
$arrayPart2Indexes = array(); | |
foreach ($part1 as $part1key => $part1Value) { |
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 test($v, $arr1) { | |
$arr2 = []; | |
while(1){ | |
$count1 = isset(array_count_values($arr1)[$v]) ? array_count_values($arr1)[$v] : 0; | |
$count2 = isset(array_count_values($arr2)[$v]) ? array_count_values($arr2)[$v] : 0; | |
if(count($arr1) == 0 || $count1 == count($arr2) - $count2) { | |
return count($arr1); | |
} | |
$arr2[] = array_shift($arr1); |
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 solution($K, $L, $M, $N, $P, $Q, $R, $S) { | |
//get inputs to check intersection | |
$leftSide = max($K, $P); | |
$rightSide = min($M, $R); | |
$bottomSide = max($L, $Q); | |
$topSide = min($N, $S); | |
//the area of the sum of the rectangles | |
$sum = (($M - $K) * ($N - $L)) + (($R - $P) * ($S - $Q)); |
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 solution($A) | |
{ | |
$sum = 0; | |
while (count($A)) { | |
// remove the last part | |
array_pop($A); |
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 | |
namespace Com\Company\System; | |
use \Com\Company\Interfaces; | |
class VerifyHelper | |
{ | |
/** |
OlderNewer