Skip to main content

Timeline for Palindrome Permutation string

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
Aug 26, 2022 at 11:30 comment added Toby Speight I was imagining counting mod 2, which is a bit shorter (hist[c] ^= 1 in the loop, then std::ranges::accumulate() to count the ones); even then, the bitset is more convenient.
Aug 24, 2022 at 0:21 comment added Deduplicator Yes, std::ranges::count_if(hist, [](auto x){return x % 2; }); would be a bit more verbose.
Aug 23, 2022 at 7:02 history edited Toby Speight CC BY-SA 4.0
Accumulate valuable tests as we go. And demonstrate that.
Aug 22, 2022 at 20:19 history edited Toby Speight CC BY-SA 4.0
Another observation
Aug 22, 2022 at 20:12 history edited Toby Speight CC BY-SA 4.0
Simplify flipping one bit
Aug 22, 2022 at 20:11 comment added Toby Speight @Deduplicator, yes that may well be true, and I did start with a std::array<bool>. But the convenience of bitset::count() swung me!
Aug 22, 2022 at 20:02 comment added Deduplicator Of course an array of some unsigned type (byte up to register size) might be more efficient (code and time, not stack). Only measuring will show.
Aug 22, 2022 at 19:57 history edited Toby Speight CC BY-SA 4.0
Use a string-view, and give it a more conventional name
Aug 22, 2022 at 18:30 comment added chux Good use of unsigned char vs. char. isPalinStr() here is poetic.
Aug 22, 2022 at 17:13 history answered Toby Speight CC BY-SA 4.0