Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2022/4/php]: Figure out why original approach to do_overlap didn't work. #1

Open
cngJo opened this issue Dec 4, 2022 · 0 comments

Comments

@cngJo
Copy link
Owner

cngJo commented Dec 4, 2022

function do_overlap(string $a, string $b): bool {
    [$lowA, $highA] = explode("-", $a);
    [$lowB, $highB] = explode("-", $b);
    return ($highA >= $lowB) || ($lowB <= $highA);
}

My thought was, that when the higher part of A of higher than (or equal to) the lower part of B or the lower part of B is lower (or equal to) then the higher part of A, the two need to overlap.

Interestingly, it produced a valid output for another input for that puzzle :D

For my Input, tho, it detected 89 "false positives".
(The actual solution way 89 lower than what my original method found)

@cngJo cngJo changed the title [2022/1/php]: Figure out why original approach to do_overlap didn't work. [2022/4/php]: Figure out why original approach to do_overlap didn't work. Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant