3 ms·
Why make it a class even, it doesn't hold any state. Also I'd do it like: DominoTilingCounter tc; std::cout << tc.count(4, 7) << '\n';
by skocznymroczny 6y ago
Why make it a class even, it doesn't hold any state. Also I'd do it like:
DominoTilingCounter tc;
std::cout << tc.count(4, 7) << '\n';
- Someone 6y agoThen, count could be a static method, and you wouldn’t need to construct the DominoTilingCounter, yielding std::cout << DominoTilingCounter.count(4, 7) << '\n'; That’s close to a free function, using the class only for grouping (say of private helper functions, or for memoization data structures)
- ratww 6y agoIn this case you can use a namespace too: std::cout << tc::count(4, 7) << '\n';