<?php$file=fopen("input.txt","r")orexit("Unable to open file");while(!feof($file)){$array[]=explode(", ",fgets($file));}fclose($file);returnarray_filter(array_map(function($val){returnarray((int)$val[0],(int)$val[1]);},$array));?>
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
PHP solution
Part 1 took me a while to figure out how to get rid of coordinates that have infinite area. Part 2 was straight forward loop.
Btw using
array_filter
was ~3x slower thanforeach
loop. PHP ¯\(ツ)/¯Part 1
Part2
readFile.php