arts-2019-06-16

Algorithm 算法题

每周至少做一个leetcode 的算法题

https://leetcode-cn.com/problems/merge-intervals/

观察后发现,可以先排序,然后再遍历一遍,即可得到结果。

遍历时,发现下一个节点左边界在当前小区域中,则拓展右边界;否则,更新当前小区域为下一个节点区域。

Review 外国文章

阅读并点评至少一篇英文技术文章

TODO

Technique 技巧总结

学习至少一个技术技巧

一般手机号是纯数字的,用字符串形式存在数据库中。
如果对手机号做了索引,那么查询时必须是字符串形式才能命中索引。

体会一下:

mysql> explain select phone from my_user where phone = 18000000000;
+----+-------------+-------------+-------+----------------------+----------------------+---------+------+--------+--------------------------+
| id | select_type | table       | type  | possible_keys        | key                  | key_len | ref  | rows   | Extra                    |
+----+-------------+-------------+-------+----------------------+----------------------+---------+------+--------+--------------------------+
|  1 | SIMPLE      | my_user | index | my_user_2277d84b | my_user_2277d84b | 162     | NULL | 116593 | Using where; Using index |
+----+-------------+-------------+-------+----------------------+----------------------+---------+------+--------+--------------------------+
1 row in set (0.00 sec)

mysql> explain select phone from my_user where phone = '18000000000';
+----+-------------+-------------+------+----------------------+----------------------+---------+-------+------+--------------------------+
| id | select_type | table       | type | possible_keys        | key                  | key_len | ref   | rows | Extra                    |
+----+-------------+-------------+------+----------------------+----------------------+---------+-------+------+--------------------------+
|  1 | SIMPLE      | my_user | ref  | my_user_2277d84b | my_user_2277d84b | 162     | const |    1 | Using where; Using index |
+----+-------------+-------------+------+----------------------+----------------------+---------+-------+------+--------------------------+
1 row in set (0.00 sec)

Share 思考分享

至少分享一篇有观点和思考的技术文章

https://mp.weixin.qq.com/s/q05Df_TKWUSlhK6V6KTrfw
优秀工程师必备的一项技能,你解锁了吗?

2019-06-16 23:26 18
Comments
Write a Comment