PAT 甲 1032 Sharing 只用一个一维数组的极简做法_哈希

该博客主要介绍了PAT甲级试题1032题的解决方法,强调使用一个一维数组的哈希策略来寻找两个单词的公共尾缀。博主首先概述了题目的输入输出规格,并分享了其他解题思路,包括正向构建链表和反向查找。接着,博主提出自己的解决方案,通过创建一个大型一维数组,根据Next指针更新计数,找到唯一出现两次的地址作为公共尾缀的开始。博客还提醒注意前导零和处理两个单词首字母相同的情况。最后,博主提到了代码在某些测试点上的超时问题,但整体已成功通过测试。
摘要由CSDN通过智能技术生成

题目出处:   https://www.patest.cn/contests/pat-a-practise/1032



Input Specification:

Each input file contains one test case. For each case, the first line contains two addresses of nodes and a positive N (<= 105), where the two addresses are the addresses of the first nodes of the two words, and N is the total number of nodes. The address of a node is a 5-digit positive integer, and NULL is represented by -1.

Then N lines follow, each describes a node in the format:

Address Data Next

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值