No Description

wolves bb44fe2957 routine 3 months ago
.cache 6b74b03d0f 251112 9 months ago
23 3f58f483ff init 11 months ago
24 3f58f483ff init 11 months ago
25 5297b42c6e routine 7 months ago
26 bb44fe2957 routine 3 months ago
dataStruct 3f58f483ff init 11 months ago
dynamic planning a96de06a95 Rename *22.cpp to 22.cpp 10 months ago
else 3f58f483ff init 11 months ago
greed 3f58f483ff init 11 months ago
key 3f58f483ff init 11 months ago
test 3f58f483ff init 11 months ago
tools 3f58f483ff init 11 months ago
we 3f58f483ff init 11 months ago
.clangd 6b74b03d0f 251112 9 months ago
.gitignore 3f58f483ff init 11 months ago
AGENTS.md e030df06c9 1018 8 months ago
README.md 3f58f483ff init 11 months ago
go.mod ed9ac364a8 routine 5 months ago
main.go 3f58f483ff init 11 months ago
test.go 06508ed118 routine 6 months ago
tools.h 3f58f483ff init 11 months ago

README.md

  • 02/2506
    • for (const string &word : words)
      {
      int state = 0;
      for (char c : word)
      {
          state |= 1 << (c - 'a');
      }
      res += cnt[state];
      cnt[state]++;
      }
      
    • 这是一种位压缩算法,巧妙的利用二进制的位来表示一个单词中出现的所有字母。

    • 关键就是state |= 1 << (c - 'a');这一行。这一行的作用是将state的第(c - 'a')位设为1,这样就可以表示这个单词中出现了字母c。

备用站点 当前处于降级运行的备用站点,仅供应急访问,数据和功能可能不是最新。