![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 66
FinnAwe
C++后台程序员
展开
-
006-008-String to Integer(atoi) 字符串转换为整数
字符串到整型的转换,使用C语言实现原创 2017-04-18 12:51:48 · 364 阅读 · 0 评论 -
020-142-Linked List Cycle II 判断链表是否有环并返回环的起点
ProblemGiven a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?...原创 2018-01-13 23:02:57 · 339 阅读 · 0 评论 -
019-141-Linked List Cycle 判断链表是否有环
ProblemGiven a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?Solution解决方法:龟兔赛跑。快慢指针。/** * Definition for singly-linked list. * s原创 2018-01-13 23:01:41 · 287 阅读 · 0 评论 -
017-101-Symmetric Tree 判断树是否对称
QuestionGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center)原创 2017-11-26 13:18:44 · 235 阅读 · 0 评论 -
007-100-判断两个二叉树是否相等 Same Tree
与二叉树相关的问题都可以简洁的递归方法解决原创 2017-11-25 11:58:43 · 615 阅读 · 1 评论 -
005-023-Merge k sorted lists 合并K个有序的链表
使用堆结构可以快速获得和删除最小值,平均效率是O(logn)原创 2017-04-15 16:03:59 · 331 阅读 · 0 评论 -
002-246-LRU Cache 最近最久未使用算法
当进程发生缺页,需要从SWAP(交换区)中换入所需的页到内存块中,此时内存却已满,需要将一个页面换出到SWAP中,选择这个换出页面的算法就是页面置换算法。LRU(Least Recently Used)置换算法是选择最近最久未被使用的页面予以淘汰。使用HashMap和双向链表来实现,简洁且高效。原创 2017-04-07 23:16:09 · 516 阅读 · 0 评论 -
004-107-Binary Tree Level Order Traversal II 层序遍历二叉树之二
ArrayList内部是基于数组实现,往ArrayList头部插入一个元素意味着移动整个数组,一次插入操作需要O(n)时间。那就用LinkedList,它是基于链表的实现,往链表的头部插入一个节点只需O(1)时间原创 2017-04-10 22:05:49 · 289 阅读 · 0 评论 -
001-021-merger two sorted List 归并两个已排序的链表
合并两个有序的链表,和归并排序中,合并两个有序的数组很相似。原创 2017-04-07 23:04:00 · 508 阅读 · 0 评论 -
003-102-Binary Tree Level Order Traversal 层序遍历二叉树
树的层序遍历很简单,树可以看成图的退化,对树的广度优先遍历就是层序遍历,我们用一个队列就可以完成。原创 2017-04-09 13:36:01 · 329 阅读 · 0 评论 -
023-191-Number of bits 无符号整数中位为1的数目
191. Number of 1 BitsQuestionWrite a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ h...原创 2018-03-05 10:06:06 · 352 阅读 · 0 评论