Imagining a sci fi book where the last remnants of humanity are forced to solve trolley problems by an AI.
“I have no mouth but I must scream” by Harlan Ellison is about an AI that’s kept a small group of humans alive indefinitely to torture them.
No trolley problems exactly, but people do make painful choices in the story.
That’s what I was thinking of, but it’s millions of people and they’re all whittling their own numbers down via being forced to participate in increasingly outlandish trolley variations.