摘要:
Problem Statement Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. 阅读全文
摘要:
Source Implement an algorithm to delete a nodein the middle of a singly linked list, given only access to that node. Example Given 1->2->3->4, and nod 阅读全文
摘要:
Source Given a singly linked list of characters, write a function that returns true if the given list is palindrome, else false. 题解1 - 使用辅助栈 根据栈的特性(FI 阅读全文
摘要:
背景 最近在对接国内的外卖平台,代码啥的正常开发、测试、上线都没发现什么异常的。突然,最近有运维反馈说漏了单据,一开始我以为是外卖平台那边接口异常,拉单延迟导致的,就没怎么放在心上。过了半天,运维那边继续反馈此类问题,且最开始那个订单依旧没有同步,这个时候我看了接口响应都是正常的,但是JSON解析返 阅读全文
摘要:
Source Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the fir 阅读全文
摘要:
Source Sort a linked list in O(n log n) time using constant space complexity. 题解1 - 归并排序(链表长度求中间节点) 链表的排序操作,对于常用的排序算法,能达到 O(nlogn) 的复杂度有快速排序(平均情况)、归并排 阅读全文
摘要:
Source A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or nul 阅读全文
摘要:
Source Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' val 阅读全文
摘要:
Source You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linke 阅读全文
摘要:
Source Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. E 阅读全文