当前位置:网站首页>An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary
An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary
2022-04-23 19:13:00 【cjzcjl】
Give me a dictionary , Find all mirrored pairs of words , If it appears in the dictionary abcd and dcba, Then list it
Personal thinking :
Use the dictionary tree , Each word is divided into a unit of each letter , Each element acts as a node . At the same time, every time you enter a word , Construct a mirror word and enter it :
Every time you add a word , If you find that before you add , Can find a fully matched path , And can run to the leaf node , It means that you have been added once by your previous mirror word , Together with their own and their own image output . In this way, you can find all the word pairs that match the pattern as long as you traverse the dictionary once .
版权声明
本文为[cjzcjl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210600587886.html
边栏推荐
- C: generic reflection
- The type initializer for ‘Gdip‘ threw an exception
- 在渤海期货办理开户安全吗。
- Esp01s with Arduino development environment
- Coolweather is revised and connected to the wind weather interface to realize the broken line diagram of temperature
- 从技术体系到商业洞察,中小研发团队架构实践之收尾篇
- SSDB foundation 2
- openlayers draw矩形
- ArcMap连接 arcgis server
- After opening the original normal project, the dependency package displays red and does not exist.
猜你喜欢
Network protocol: SCTP flow control transmission protocol
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
Keysight has chosen what equipment to buy for you
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
Openharmony open source developer growth plan, looking for new open source forces that change the world!
ArcMap连接 arcgis server
Raspberry pie 18b20 temperature
Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
I just want to leave a note for myself
The difference between ordinary inner class and static inner class
随机推荐
c1000k TCP 连接上限测试
On the forced conversion of C language pointer
redis优化系列(三)解决主从配置后的常见问题
FTP、ssh远程访问及控制
Quick start to static class variables
高层次人才一站式服务平台开发 人才综合服务平台系统
Openlayers 5.0 two centering methods
After opening the original normal project, the dependency package displays red and does not exist.
微搭低代码零基础入门课(第三课)
Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
Codeforces Round #784 (Div. 4)
[报告] Microsoft :Application of deep learning methods in speech enhancement
Disable Ctrl + Alt + Del
Simplified path (force buckle 71)
The type initializer for ‘Gdip‘ threw an exception
SSDB foundation 1
腾讯云GPU最佳实践-使用jupyter pycharm远程开发训练
SQL常用的命令
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
SQL server requires to query the information of all employees with surname 'Wang'