文章
[Leetcode] Intersection of Two Linked Lists 链表交点
双指针法复杂度时间O(N)空间O(1)思路先算出两个链表各自的长度,然后从较长的链表先遍历,遍历到较长链表剩余长度和较短链表一样时,用两个指针同时遍历两个链表。这样如果链表有交点的话,两个指针已经一定会相遇。代码<pre<
[Leetcode] Group Anagrams 变形词
GroupAnagrams最新更新请见:https://yanjia.me/zh/2019/01/...(https://link.segmentfault.com/?encFBW3uL46qfFMdXuezARaQg%3D%3D.qrwGQjqmZ6hI3VVCxU
[Leetcode] Majority Element 众数
MajorityElementI<blockquote<pGivenanarrayofsizen,findthemajorityelement.Themajorityelementistheelementthatappearsmoreth
[Leetcode] Trapping Rain Water 积水问题
TrappingRainWater<blockquote<pGivennnonnegativeintegersrepresentinganelevationmapwherethewidthofeachbaris1,computehowmuc
[Leetcode] 3Sum 4Sum 3Sum Closet 多数和
2Sum在分析多数和之前,请先看TwoSum的详解(http://segmentfault.com/a/1190000002986095)3Sum请参阅:https://yanjia.me/zh/2019/01/...(https://link.segment
[Leetcode] Implement Queue using Stacks 用栈实现队列
ImplementQueueusingStacks<blockquote<pImplementthefollowingoperationsofaqueueusingstacks.</p<ppush(x)Pushelementxtothe
[Leetcode] Merge Two Sorted Lists Merge K Sorted Lists 归并有序列表
MergeTwoSortedLists最新更新请见:https://yanjia.me/zh/2019/01/...(https://link.segmentfault.com/?enc8utPsLQxpQD4Lfi4BD%2FZ1A%3D%3D.Dzwz5OfD
[Leecode] Linked List Cycle 链表环
LinkedListCycleI<blockquoteGivenalinkedlist,determineifithasacycleinit.<pFollowup:Canyousolveitwithoutusingextraspace?
[Leetcode] Roman to Integer and Integer to Roman 罗马数阿拉伯数转换
ValidRomanNumeral正则表达式思路首先我们要熟悉罗马数的表达方式。M是1000,D是500,C是100,L是50,X是10,V是5,I是1。验证字符串是否是罗马数,我们先看一下有效的罗马数是什么样的,假设该数字小于5000,从千位到个位
[Leetcode] Implement Trie 实现前缀树
ImplementTrie<blockquote<pImplementatriewithinsert,search,andstartsWithmethods.</p<pNote:Youmayassumethatallinputsarecon
已加载文章中没有匹配内容,试试其他关键词或清空搜索。