值得提高的地方(持续更新)

11/12

1. 一定要考虑最角落的edge case。比如input是0(对于int),或者empty string(对于string),或者空list(对于各种map,list,array)。

2. 一定要记得不同的data structure对应不同的 添加元素 的方法。

Data structure 添加元素的方法
Map (HashMap, HashTable) put
Set (HashSet) add
List (ArrayList) add
String No internal add/append methods
StringBuilder/StringBuffer append, insert

3. 口头跑程序。

4. 注意edge case。

5. 在两个loop的时候,关注内loop的起始指针的位置。

6. 多倒推,多思考需求,从而提高效率。

猜你喜欢

转载自www.cnblogs.com/yxcindy/p/9953243.html