当前位置:网站首页>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
边栏推荐
- Screenshot using projectmediamanager
- mysql_linux版本的下载及安装详解
- Openlayers 5.0 thermal diagram
- mysql_linux版本的下載及安裝詳解
- JS controls the file type and size when uploading files
- 电路在线模拟
- Quick start to static class variables
- From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure
- Keysight has chosen what equipment to buy for you
- FTP、ssh远程访问及控制
猜你喜欢
FTP, SSH Remote Access and control
[记录]TypeError: this.getOptions is not a function
MySQL restores or rolls back data through binlog
从技术体系到商业洞察,中小研发团队架构实践之收尾篇
[advanced level 11 of C language -- character and string functions and their simulation implementation (2)]
Some records used by VS2010
SQL常用的命令
网络协议之:sctp流控制传输协议
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
Android Development: the client obtains the latest value in the database in real time and displays it on the interface
随机推荐
SSDB foundation 3
Getting started with vcpkg
2022.04.23 (the best time for lc_714_to buy and sell stocks, including handling charges)
Problems caused by flutter initialroute and home
Solve the problem of invalid listview Click
SQL常用的命令
[报告] Microsoft :Application of deep learning methods in speech enhancement
Codeforces Round #784 (Div. 4)
mysql_linux版本的下載及安裝詳解
SSDB foundation 1
SSDB基础3
Regular expressions for judging positive integers
SSDB基础
Go language GUI framework Fyne Chinese garbled or not displayed
c#:泛型反射
WebView opens H5 video and displays gray background or black triangle button. Problem solved
从技术体系到商业洞察,中小研发团队架构实践之收尾篇
Class loading process of JVM
Openlayers 5.0 reload the map when the map container size changes
An 8266 crash