#ifndef S0142_LINKED_LIST_CYCLE_HPP #define S0142_LINKED_LIST_CYCLE_HPP #include #include "structures.hpp" struct IterResult { ListNode *node; bool meet; }; class S0142 { public: std::unordered_map footprint; IterResult iter(ListNode *fast, ListNode *slow, bool startUp); ListNode *detectCycle(ListNode *head); }; #endif