Skip to content

Conversation

@Philippus
Copy link
Contributor

No description provided.

@Philippus Philippus force-pushed the article-day-7 branch 2 times, most recently from ea858b4 to 327bba8 Compare December 7, 2024 11:14
@SethTisue
Copy link
Collaborator

SethTisue commented Dec 7, 2024

Thank you @Philippus ! I had volunteered for day 7, but I saw your PR in time and at #571 I moved my volunteer slot to day 10 instead. If you plan to submit any further articles, please check the schedule first.

@Philippus
Copy link
Contributor Author

Thank you @Philippus ! I had volunteered for day 7, but I saw your PR in time and at #571 I moved my volunteer slot to day 10 instead. If you plan to submit any further articles, please check the schedule first.

Ah, I'm sorry. I didn't know about the schedule.

@SethTisue
Copy link
Collaborator

SethTisue commented Dec 7, 2024

@Philippus you might enjoy: (SPOILER)

instead of processing the numbers in the equation from left to right, I process them from right to left. this allows you to prune the search space a lot and not test all possible equations. for example if you've got: 12345: ..... 2 you can see that 12345 isn't divisible by 2, so you don't need to consider equations ending in * 2, and 12345 doesn't end in 2 so you don't need to consider equations ending in | 2. so you can recurse only on the possibility of addition and continue with 12343: ...

the sample input today isn't big enough for it to really matter, but the approach could be worth keeping in mind in case it becomes applicable again later in the month

(for the article, though, I think the approach you took is totally fine)

@SethTisue SethTisue merged commit 26e5484 into scalacenter:website Dec 8, 2024
@Philippus Philippus deleted the article-day-7 branch December 8, 2024 07:37
@SethTisue SethTisue mentioned this pull request Dec 11, 2024
@SethTisue SethTisue mentioned this pull request Dec 19, 2024
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

Successfully merging this pull request may close these issues.

2 participants