![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
code_better
梦想,让我们有所不同
展开
-
leetcode之Add Digits
最近在做leetcode上面的题目(官网网址:https://leetcode.com/),记录下自己的思路。 本题网址:https://leetcode.com/problems/add-digits/ 题目: Given a non-negative integer num, repeatedly add all its digits until the result has onl原创 2016-04-26 21:30:28 · 517 阅读 · 0 评论 -
《Java程序员面试笔试宝典》读书笔记——链表常用操作
一、如何从链表中删除重复数据 把遍历的值存储到一个Hashtable中,利用其去重的特性。优点:时间复杂度低 缺点:需要额外的存储空间来保存已遍历过的值 更为高效的办法:对链表进行双重循环遍历,外循环正常遍历链表,假设外循环当前遍历的结点为cur,内循环从cur开始遍历,若碰到与cur所指向结点值相同,则删除这个重复结点。优点:不需要额外的存储空间 缺点:时间复杂度高 算法如下: public v原创 2017-08-14 12:47:30 · 659 阅读 · 0 评论