
leetcode
Evabook
慢慢爬的蜗牛
展开
-
leetcode part1--十六进制的转换
题目: Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase.The hexadeci...原创 2019-05-22 19:14:24 · 464 阅读 · 0 评论 -
leetcode part2 --two sum with hashmap
1、hashmap是一个散列桶(数组和链表),它存储的内容是键值对(key-value)映射。2、put(key,value)存储数据。先对键通过hashcode()找到要存储的桶bucket,如果无碰撞,直接放入桶中,有碰撞的话,则以链表的方式链接在后边。如果链表长度超过阀值( TREEIFY THRESHOLD==8),就把链表转成红黑树,链表长度低于6,就把红黑树转回链表3、get(ke...原创 2019-06-20 11:57:21 · 245 阅读 · 0 评论