美文网首页
Hash的key,使用float型替换int型

Hash的key,使用float型替换int型

作者: papi_k的小茅屋 | 来源:发表于2023-12-13 09:18 被阅读0次

我们知道常用的hash结构体为

typedef struct {
    **int key;** // 使用整型做key
    int value;
    UT_hash_handle hh;
} HashNode;

但是做力扣的[149题 直线上最多的点数]时,如果将整型的int key改为浮点型的float key,竟然AC了,我去!

typedef struct {
    **float key;** // 换成float类型
    int value;
    UT_hash_handle hh;
} HashNode;

相关文章

网友评论

      本文标题:Hash的key,使用float型替换int型

      本文链接:https://www.haomeiwen.com/subject/pbnvgdtx.html