Comment

Comment by comsolo

err 20 min? It's about a 60 second problem.

<?php $lines = explode("\n", strtolower(file_get_contents("input.txt"))); foreach ($lines as $ln) { for ($i = 0; $i < strlen($ln); $i++) { $char = $ln[$i]; $first_pos = strpos($ln, $char); $second_pos = strpos($ln, $char, $first_pos+1); $is_repeating = $second_pos !== false; if (!$is_repeating) { echo $char."\n"; break; } } }

?>

parent comsolo 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton