News for hackers. Stuff that matters.
Re:Many Hard LeetCode Problems Are Easy Constraint Problems by nextos on Friday September 12, 2025 @12:06PM (#45223661)
FWIW, the OP's problem is not linear. It's an integer programming problem given that coins are discrete.

A trick if you can't do a custom algorithm and using a library is not allowed during interview could be to be ready to roll your own DPLL-based solver (can be done in 30 LOC).

Less elegant, but it's a one-size-fits-all solution.

Re:Many Hard LeetCode Problems Are Easy Constraint Problems by kragen on Friday September 12, 2025 @05:20PM (#45226900)
You can implement DPLL in 30 lines of code? Not for SMT, I assume.
Re:Many Hard LeetCode Problems Are Easy Constraint Problems by nextos on Friday September 12, 2025 @10:09PM (#45228747)
You'd need a fancy encoding for SAT to use a small DPLL implementation.

Otherwise, customize DPLL for this particular problem.