#include <optional> /** * struct ListNode { * int val; * struct ListNode *next; * ListNode(int x) : val(x), next(nullptr) {} * }; */ class Solution { ListNode* head = nullptr; bool ok{true}; std::optional<ListNode*> work(ListNode* node) { std::optional<ListNode*> compareNode = null...