HT290WordPattern
来源:互联网 发布:淘宝承接页是什么 编辑:程序博客网 时间:2024/05/22 22:24
思路
- 一个hashmap
- 一个hashmap
- 一个StringArray
易错
- 一旦用for开始循环,就要想到length==0的情况,尤其是string
- String should not use
==
to compare, should use_String.equals()
Some tricks
- String can be “” but is not null. Should use _String.length() to judge. Be smart to use _String.length() or _Array.length to get rid of corner cases.
- In HashMap, if you have to judge (containsValue), you may need to exchange the key and value to avoid this
Failed Test Cases
- Diff Keys but same values
"abba""dog dog dog dog"
- If too many chars in the pattern, the
Index as Value Hash Map method
would concur a problem that the length of pattern go beyond the length of Integer. We should use
Objects.equals(oneObject, theOtherObject)
0 0
- HT290WordPattern
- CheckStyle安装
- android中的ProgressDialog(进度),DatePickerDialog(日期选择)与TimePickerDialog(时间选择)
- dubbo多协议和多注册中心
- MySql数据库行锁与表锁解析
- BAPI_GOODSMVT_CREATE 262冲销投料、提货数
- HT290WordPattern
- POJ1979(DFS深度优先搜索)之 Red and Black
- 发生的发生的发生地方
- 快速排序
- PPT 如何做好关卡设计
- 题目1083:特殊乘法[数位拆解]
- Linux下SSH免密码登录
- Python的生成器和迭代器
- 强化学习(一)