10000 leetcode/src/LRUCache/LRUCache.cpp at master · bigxing/leetcode · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"src/LRUCache":{"items":[{"name":"LRUCache.cpp","path":"src/LRUCache/LRUCache.cpp","contentType":"file"}],"totalCount":1},"src":{"items":[{"name":"3Sum","path":"src/3Sum","contentType":"directory"},{"name":"3SumClosest","path":"src/3SumClosest","contentType":"directory"},{"name":"4Sum","path":"src/4Sum","contentType":"directory"},{"name":"LRUCache","path":"src/LRUCache","contentType":"directory"},{"name":"addBinary","path":"src/addBinary","contentType":"directory"},{"name":"addTwoNumbers","path":"src/addTwoNumbers","contentType":"directory"},{"name":"anagrams","path":"src/anagrams","contentType":"directory"},{"name":"balancedBinaryTree","path":"src/balancedBinaryTree","contentType":"directory"},{"name":"bestTimeToBuyAndSellStock","path":"src/bestTimeToBuyAndSellStock","contentType":"directory"},{"name":"binaryTreeInorderTraversal","path":"src/binaryTreeInorderTraversal","contentType":"directory"},{"name":"binaryTreeLevelOrderTraversal","path":"src/binaryTreeLevelOrderTraversal","contentType":"directory"},{"name":"binaryTreeMaximumPathSum","path":"src/binaryTreeMaximumPathSum","contentType":"directory"},{"name":"binaryTreePostorderTraversal","path":"src/binaryTreePostorderTraversal","contentType":"directory"},{"name":"binaryTreePreorderTraversal","path":"src/binaryTreePreorderTraversal","contentType":"directory"},{"name":"binaryTreeUpsideDown","path":"src/binaryTreeUpsideDown","contentType":"directory"},{"name":"binaryTreeZigzagLevelOrderTraversal","path":"src/binaryTreeZigzagLevelOrderTraversal","contentType":"directory"},{"name":"candy","path":"src/candy","contentType":"directory"},{"name":"climbStairs","path":"src/climbStairs","contentType":"directory"},{"name":"cloneGraph","path":"src/cloneGraph","contentType":"directory"},{"name":"combinationSum","path":"src/combinationSum","contentType":"directory"},{"name":"combinations","path":"src/combinations","contentType":"directory"},{"name":"compareVersionNumbers","path":"src/compareVersionNumbers","contentType":"directory"},{"name":"constructBinaryTreeFromInorderAndPostorderTraversal","path":"src/constructBinaryTreeFromInorderAndPostorderTraversal","contentType":"directory"},{"name":"constructBinaryTreeFromPreorderAndInorderTraversal","path":"src/constructBinaryTreeFromPreorderAndInorderTraversal","contentType":"directory"},{"name":"containerWithMostWater","path":"src/containerWithMostWater","contentType":"directory"},{"name":"convertSortedArrayToBinarySearchTree","path":"src/convertSortedArrayToBinarySearchTree","contentType":"directory"},{"name":"convertSortedListToBinarySearchTree","path":"src/convertSortedListToBinarySearchTree","contentType":"directory"},{"name":"copyListWithRandomPointer","path":"src/copyListWithRandomPointer","contentType":"directory"},{"name":"countAndSay","path":"src/countAndSay","contentType":"directory"},{"name":"decodeWays","path":"src/decodeWays","contentType":"directory"},{"name":"distinctSubsequences","path":"src/distinctSubsequences","contentType":"directory"},{"name":"divideTwoInt","path":"src/divideTwoInt","contentType":"directory"},{"name":"editDistance","path":"src/editDistance","contentType":"directory"},{"name":"evaluateReversePolishNotation","path":"src/evaluateReversePolishNotation","contentType":"directory"},{"name":"findMinimumInRotatedSortedArray","path":"src/findMinimumInRotatedSortedArray","contentType":"directory"},{"name":"findPeakElement","path":"src/findPeakElement","contentType":"directory"},{"name":"firstMissingPositive","path":"src/firstMissingPositive","contentType":"directory"},{"name":"flattenBinaryTreeToLinkedList","path":"src/flattenBinaryTreeToLinkedList","contentType":"directory"},{"name":"fractionToRecurringDecimal","path":"src/fractionToRecurringDecimal","contentType":"directory"},{"name":"gasStation","path":"src/gasStation","contentType":"directory"},{"name":"generateParentheses","path":"src/generateParentheses","contentType":"directory"},{"name":"grayCode","path":"src/grayCode","contentType":"directory"},{"name":"insertInterval","path":"src/insertInterval","contentType":"directory"},{"name":"insertionSortList","path":"src/insertionSortList","contentType":"directory"},{"name":"integerToRoman","path":"src/integerToRoman","contentType":"directory"},{"name":"interleavingString","path":"src/interleavingString","contentType":"directory"},{"name":"intersectionOfTwoLinkedLists","path":"src/intersectionOfTwoLinkedLists","contentType":"directory"},{"name":"jumpGame","path":"src/jumpGame","contentType":"directory"},{"name":"largestRectangleInHistogram","path":"src/largestRectangleInHistogram","contentType":"directory"},{"name":"lengthOfLastWord","path":"src/lengthOfLastWord","contentType":"directory"},{"name":"letterCombinationsOfAPhoneNumber","path":"src/letterCombinationsOfAPhoneNumber","contentType":"directory"},{"name":"linkedListCycle","path":"src/linkedListCycle","contentType":"directory"},{"name":"longestCommonPrefix","path":"src/longestCommonPrefix","contentType":"directory"},{"name":"longestConsecutiveSequence","path":"src/longestConsecutiveSequence","contentType":"directory"},{"name":"longestPalindromicSubstring","path":"src/longestPalindromicSubstring","contentType":"directory"},{"name":"longestSubstringWithAtMostTwoDistinctCharacters","path":"src/longestSubstringWithAtMostTwoDistinctCharacters","contentType":"directory"},{"name":"longestSubstringWithoutRepeatingCharacters","path":"src/longestSubstringWithoutRepeatingCharacters","contentType":"directory"},{"name":"longestValidParentheses","path":"src/longestValidParentheses","contentType":"directory"},{"name":"maxPointsOnALine","path":"src/maxPointsOnALine","contentType":"directory"},{"name":"maximalRectangle","path":"src/maximalRectangle","contentType":"directory"},{"name":"maximumDepthOfBinaryTree","path":"src/maximumDepthOfBinaryTree","contentType":"directory"},{"name":"maximumGap","path":"src/maximumGap","contentType":"directory"},{"name":"maximumProductSubarray","path":"src/maximumProductSubarray","contentType":"directory"},{"name":"maximumSubArray","path":"src/maximumSubArray","contentType":"directory"},{"name":"medianOfTwoSortedArrays","path":"src/medianOfTwoSortedArrays","contentType":"directory"},{"name":"mergeIntervals","path":"src/mergeIntervals","contentType":"directory"},{"name":"mergeKSortedLists","path":"src/mergeKSortedLists","contentType":"directory"},{"name":"mergeTwoSortedArray","path":"src/mergeTwoSortedArray","contentType":"directory"},{"name":"mergeTwoSortedList","path":"src/mergeTwoSortedList","contentType":"directory"},{"name":"minStack","path":"src/minStack","contentType":"directory"},{"name":"minimumDepthOfBinaryTree","path":"src/minimumDepthOfBinaryTree","contentType":"directory"},{"name":"minimumPathSum","path":"src/minimumPathSum","contentType":"directory"},{"name":"minimumWindowSubstring","path":"src/minimumWindowSubstring","contentType":"directory"},{"name":"missingRanges","path":"src/missingRanges","contentType":"directory"},{"name":"multiplyStrings","path":"src/multiplyStrings","contentType":"directory"},{"name":"nQueens","path":"src/nQueens","contentType":"directory"},{"name":"nextPermutation","path":"src/nextPermutation","contentType":"directory"},{"name":"oneEditDistance","path":"src/oneEditDistance","contentType":"directory"},{"name":"palindromeNumber","path":"src/palindromeNumber","contentType":"directory"},{"name":"palindromePartitioning","path":"src/palindromePartitioning","contentType":"directory"},{"name":"partitionList","path":"src/partitionList","contentType":"directory"},{"name":"pascalTriangle","path":"src/pascalTriangle","contentType":"directory"},{"name":"pathSum","path":"src/pathSum","contentType":"directory"},{"name":"permutationSequence","path":"src/permutationSequence","contentType":"directory"},{"name":"permutations","path":"src/permutations","contentType":"directory"},{"name":"plusOne","path":"src/plusOne","contentType":"directory"},{"name":"populatingNextRightPointersInEachNode","path":"src/populatingNextRightPointersInEachNode","contentType":"directory"},{"name":"pow","path":"src/pow","contentType":"directory"},{"name":"readNCharactersGivenRead4","path":"src/readNCharactersGivenRead4","contentType":"directory"},{"name":"recoverBinarySearchTree","path":"src/recoverBinarySearchTree","contentType":"directory"},{"name":"regularExpressionMatching","path":"src/regularExpressionMatching","contentType":"directory"},{"name":"removeDuplicatesFromSortedArray","path":"src/removeDuplicatesFromSortedArray","contentType":"directory"},{"name":"removeDuplicatesFromSortedList","path":"src/removeDuplicatesFromSortedList","contentType":"directory"},{"name":"removeElement","path":"src/removeElement","contentType":"directory"},{"name":"removeNthNodeFromEndOfList","path":"src/removeNthNodeFromEndOfList","contentType":"directory"},{"name":"reorderList","path":"src/reorderList","contentType":"directory"},{"name":"restoreIPAddresses","path":"src/restoreIPAddresses","contentType":"directory"},{"name":"reverseInteger","path":"src/reverseInteger","contentType":"directory"},{"name":"reverseLinkedList","path":"src/reverseLinkedList","contentType":"directory"},{"name":"reverseNodesInKGroup","path":"src/reverseNodesInKGroup","contentType":"directory"},{"name":"reverseWordsInAString","path":"src/reverseWordsInAString","contentType":"directory"},{"name":"romanToInteger","path":"src/romanToInteger","contentType":"directory"},{"name":"rotateImage","path":"src/rotateImage","contentType":"directory"},{"name":"rotateList","path":"src/rotateList","contentType":"directory"},{"name":"sameTree","path":"src/sameTree","contentType":"directory"},{"name":"scrambleString","path":"src/scrambleString","contentType":"directory"},{"name":"search2DMatrix","path":"src/search2DMatrix","contentType":"directory"},{"name":"searchForRange","path":"src/searchForRange","contentType":"directory"},{"name":"searchInRotatedSortedArray","path":"src/searchInRotatedSortedArray","contentType":"directory"},{"name":"searchInsertPosition","path":"src/searchInsertPosition","contentType":"directory"},{"name":"setMatrixZeroes","path":"src/setMatrixZeroes","contentType":"directory"},{"name":"simplifyPath","path":"src/simplifyPath","contentType":"directory"},{"name":"singleNumber","path":"src/singleNumber","contentType":"directory"},{"name":"sortColors","path":"src/sortColors","contentType":"directory"},{"name":"sortList","path":"src/sortList","contentType":"directory"},{"name":"spiralMatrix","path":"src/spiralMatrix","contentType":"directory"},{"name":"sqrt","path":"src/sqrt","contentType":"directory"},{"name":"strStr","path":"src/strStr","contentType":"directory"},{"name":"stringToIntegerAtoi","path":"src/stringToIntegerAtoi","contentType":"directory"},{"name":"subsets","path":"src/subsets","contentType":"directory"},{"name":"substringWithConcatenationOfAllWords","path":"src/substringWithConcatenationOfAllWords","contentType":"directory"},{"name":"sudokuSolver","path":"src/sudokuSolver","contentType":"directory"},{"name":"sumRootToLeafNumber","path":"src/sumRootToLeafNumber","contentType":"directory"},{"name":"surroundedRegions","path":"src/surroundedRegions","contentType":"directory"},{"name":"swapNodesInPairs","path":"src/swapNodesInPairs","contentType":"directory"},{"name":"symmetricTree","path":"src/symmetricTree","contentType":"directory"},{"name":"textJustification","path":"src/textJustification","contentType":"directory"},{"name":"trappingRainWater","path":"src/trappingRainWater","contentType":"directory"},{"name":"triangle","path":"src/triangle","contentType":"directory"},{"name":"twoSum","path":"src/twoSum","contentType":"directory"},{"name":"uniqueBinarySearchTrees","path":"src/uniqueBinarySearchTrees","contentType":"directory"},{"name":"uniquePaths","path":"src/uniquePaths","contentType":"directory"},{"name":"validNumber","path":"src/validNumber","contentType":"directory"},{"name":"validPalindrome","path":"src/validPalindrome","contentType":"directory"},{"name":"validParentheses","path":"src/validParentheses","contentType":"directory"},{"name":"validSudoku","path":"src/validSudoku","contentType":"directory"},{"name":"validateBinarySearchTree","path":"src/validateBinarySearchTree","contentType":"directory"},{"name":"wildcardMatching","path":"src/wildcardMatching","contentType":"directory"},{"name":"wordBreak","path":"src/wordBreak","contentType":"directory"},{"name":"wordLadder","path":"src/wordLadder","contentType":"directory"},{"name":"wordSearch","path":"src/wordSearch","contentType":"directory"},{"name":"zigZagConversion","path":"src/zigZagConversion","contentType":"directory"}],"totalCount":142},"":{"items":[{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":3}},"fileTreeProcessingTime":75.29098300000001,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":28124830,"defaultBranch":"master","name":"leetcode","ownerLogin":"bigxing","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2014-12-17T06:40:36.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/2263763?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1616564448.550612","canEdit":false,"refType":"branch","currentOid":"658c7907512c6e1c09b560612b765dc472d54373"},"path":"src/LRUCache/LRUCache.cpp","currentUser":null,"blob":{"rawLines":["// Source : https://oj.leetcode.com/problems/lru-cache/","// Author : Hao Chen","// Date : 2014-10-12","","/********************************************************************************** ","* ","* Design and implement a data structure for Least Recently Used (LRU) cache. ","* It should support the following operations: get and set.","* ","* get(key) - Get the value (will always be positive) of the key if the key exists ","* in the cache, otherwise return -1.","*","* set(key, value) - Set or insert the value if the key is not already present. ","* When the cache reached its capacity, it should invalidate ","* the least recently used item before inserting a new item.","* ","**********************************************************************************/","","#include \u003cstdlib.h\u003e","#include \u003ctime.h\u003e","#include \u003ciostream\u003e","#include \u003cmap\u003e","using namespace std;","","// The idea here is quite simple:","// 1) A Map to index the key. O(1) key search time-complexity.","// 2) A List to sort the cache data by accessed time.","// ","// Considering there are too many insert/delete opreations for the List, ","// The ouble linked list is the good data structure to performance it.","","class Node {"," public:"," int key;"," int value;"," Node *next, *prev;"," Node(int k, int v) { key=k; value=v; next = prev = NULL; }"," //Node(int k, int v, Node* n=NULL, Node* p=NULL): key(k), value(v), next(n), prev(p) {}","};","","// the following double linked list seems a bit commplicated.","class DoubleLinkedList {",""," private:",""," Node *pHead, *pTail;"," int size;","",""," public:",""," DoubleLinkedList(){"," pHead = pTail = NULL;"," size = 0;"," }"," ~DoubleLinkedList() {"," while(pHead!=NULL){"," Node*p = pHead;"," pHead = pHead-\u003enext;"," delete p;"," }"," }",""," int Size() const {"," return size;"," }",""," Node* NewAtBegin(int key, int value) {"," Node *n = new Node(key, value);"," return AddAtBegin(n);"," }",""," Node* NewAtEnd(int key, int value) {"," Node *n = new Node(key, value);"," return AddAtEnd(n);"," }",""," Node* AddAtBegin(Node* n){"," size++;",""," if (pHead==NULL) { "," pHead = pTail = n; "," return n; "," }",""," n-\u003enext = pHead;"," n-\u003eprev = NULL;"," pHead-\u003eprev = n;"," pHead = n;"," return n;"," }",""," Node* AddAtEnd(Node* n) {"," size++;",""," if (pHead==NULL) { "," pHead = pTail = n; "," return n; "," }",""," pTail-\u003enext = n;"," n-\u003eprev = pTail;"," n-\u003enext = NULL;"," pTail = n;"," }",""," void Unlink(Node* n){"," Node* before = n-\u003eprev;"," Node* after = n-\u003enext;",""," if (before){"," before-\u003enext = after; "," }",""," if (after){ "," after-\u003eprev = before;"," }",""," if(pHead == n){"," pHead = pHead-\u003enext;"," }else if(pTail == n) {"," pTail = pTail-\u003eprev;"," }",""," size--;"," }",""," void Delete(Node* n){"," Unlink(n);"," delete n;"," }",""," void TakeToBegin(Node* n){"," Unlink(n);"," AddAtBegin(n);"," } ",""," Node* GetTailNode() {"," return pTail;"," } ",""," void DeleteLast() {"," Delete(pTail);"," } ",""," void Print(){"," Node* p = pHead;"," while(p!=NULL) {"," cout \u003c\u003c \"(\" \u003c\u003c p-\u003ekey \u003c\u003c \",\" \u003c\u003c p-\u003evalue \u003c\u003c \") \";"," p = p-\u003enext;"," }"," cout \u003c\u003c endl;"," }","};","","","","class LRUCache{",""," private:"," //cacheList - store the date"," DoubleLinkedList cacheList;"," //cacheMap - index the date for searching"," map\u003cint, Node*\u003e cacheMap;"," //the max capcity of cache"," int capacity;",""," public:"," LRUCache(int capacity) {"," this-\u003ecapacity = capacity; "," }"," void print(){"," cacheList.Print();"," }",""," int get(int key) {"," // The accessed node must be up-to-time -- take to the front "," if (cacheMap.find(key) != cacheMap.end() ){"," cacheList.TakeToBegin(cacheMap[key]);"," return cacheMap[key]-\u003evalue;"," }"," return -1;",""," }",""," void set(int key, int value) {"," // key found, update the data, and take to the front "," if (cacheMap.find(key) != cacheMap.end() ){"," Node *p = cacheMap[key];"," p-\u003evalue = value;"," cacheList.TakeToBegin(cacheMap[key]);"," }else{"," // key not found, new a node to store data"," cacheMap[key] = cacheList.NewAtBegin(key, value);"," // if the capacity exceed, remove the last one."," if( cacheList.Size() \u003e capacity) {"," int key = cacheList.GetTailNode()-\u003ekey; "," cacheMap.erase(key);"," cacheList.DeleteLast();"," }"," }"," }","};","","","int main(int argc, char** argv) ","{",""," /*"," LRUCache c(2);"," c.set(2,1);"," c.print();"," c.set(2,2);"," c.print();"," c.get(2);"," c.print();"," c.set(1,1);"," c.print();"," c.set(4,1);"," c.print();"," c.get(2);"," c.print();",""," cout \u003c\u003c \"---------\" \u003c\u003c endl;"," */"," srand(time(0));",""," int capacity = 5;"," int test_loop_times = 10;"," if (argc\u003e1){"," capacity = atoi(argv[1]);"," }"," if (argc\u003e2){"," test_loop_times = atoi(argv[1]);"," }",""," LRUCache cache(capacity);",""," int v; "," for(int i=0; i\u003ctest_loop_times; i++) {"," v = i;//rand() % capacity;"," cout \u003c\u003c \"set \" \u003c\u003c v \u003c\u003c \": \";"," cache.set(v, v);"," cache.print();",""," v = rand() % capacity;"," cout \u003c\u003c \"get \" \u003c\u003c v \u003c\u003c \": \" \u003c\u003c cache.get(v);"," cache.print();",""," cout \u003c\u003c endl;"," }"," return 0;","}"],"stylingDirectives":[[[0,55,"pl-c"],[0,2,"pl-c"]],[[0,20,"pl-c"],[0,2,"pl-c"]],[[0,22,"pl-c"],[0,2,"pl-c"]],[],[[0,84,"pl-c"],[0,2,"pl-c"]],[[0,2,"pl-c"]],[[0,77,"pl-c"]],[[0,58,"pl-c"]],[[0,2,"pl-c"]],[[0,85,"pl-c"]],[[0,50,"pl-c"]],[[0,1,"pl-c"]],[[0,82,"pl-c"]],[[0,81,"pl-c"]],[[0,80,"pl-c"]],[[0,16,"pl-c"]],[[0,83,"pl-c"],[81,83,"pl-c"]],[],[[1,8,"pl-k"],[9,19,"pl-s"],[9,10,"pl-pds"],[18,19,"pl-pds"]],[[1,8,"pl-k"],[9,17,"pl-s"],[9,10,"pl-pds"],[16,17,"pl-pds"]],[[1,8,"pl-k"],[9,19,"pl-s"],[9,10,"pl-pds"],[18,19,"pl-pds"]],[[1,8,"pl-k"],[9,14,"pl-s"],[9,10,"pl-pds"],[13,14,"pl-pds"]],[[0,5,"pl-k"],[6,15,"pl-k"],[16,19,"pl-en"],[19,20,"pl-k"]],[],[[0,33,"pl-c"],[0,2,"pl-c"]],[[0,66,"pl-c"],[0,2,"pl-c"]],[[0,56,"pl-c"],[0,2,"pl-c"]],[[0,3,"pl-c"],[0,2,"pl-c"]],[[0,74,"pl-c"],[0,2,"pl-c"]],[[0,71,"pl-c"],[0,2,"pl-c"]],[],[[0,5,"pl-k"],[6,10,"pl-en"]],[[4,11,"pl-k"]],[[8,11,"pl-k"]],[[8,11,"pl-k"]],[],[[8,12,"pl-en"],[13,16,"pl-k"],[20,23,"pl-k"],[59,63,"pl-c1"]],[[8,95,"pl-c"],[8,10,"pl-c"]],[],[],[[0,61,"pl-c"],[0,2,"pl-c"]],[[0,5,"pl-k"],[6,22,"pl-en"]],[],[[4,12,"pl-k"]],[],[],[[8,11,"pl-k"]],[],[],[[4,11,"pl-k"]],[],[[8,24,"pl-en"]],[[28,32,"pl-c1"]],[[19,20,"pl-c1"]],[],[[8,25,"pl-en"]],[[12,17,"pl-k"],[25,29,"pl-c1"]],[],[[31,35,"pl-smi"]],[[16,22,"pl-k"]],[],[],[],[[8,11,"pl-k"],[12,16,"pl-en"],[19,24,"pl-k"]],[[12,18,"pl-k"]],[],[],[[14,24,"pl-en"],[25,28,"pl-k"],[34,37,"pl-k"]],[[22,25,"pl-k"],[26,30,"pl-c1"]],[[12,18,"pl-k"],[19,29,"pl-c1"]],[],[],[[14,22,"pl-en"],[23,26,"pl-k"],[32,35,"pl-k"]],[[22,25,"pl-k"],[26,30,"pl-c1"]],[[12,18,"pl-k"],[19,27,"pl-c1"]],[],[],[[14,24,"pl-en"]],[],[],[[12,14,"pl-k"],[23,27,"pl-c1"]],[],[[16,22,"pl-k"]],[],[],[[15,19,"pl-smi"]],[[15,19,"pl-smi"],[22,26,"pl-c1"]],[[19,23,"pl-smi"]],[],[[12,18,"pl-k"]],[],[],[[14,22,"pl-en"]],[],[],[[12,14,"pl-k"],[23,27,"pl-c1"]],[],[[16,22,"pl-k"]],[],[],[[19,23,"pl-smi"]],[[15,19,"pl-smi"]],[[15,19,"pl-smi"],[22,26,"pl-c1"]],[],[],[],[[8,12,"pl-k"],[13,19,"pl-en"]],[[30,34,"pl-smi"]],[[29,33,"pl-smi"]],[],[[12,14,"pl-k"]],[[24,28,"pl-smi"]],[],[],[[12,14,"pl-k"]],[[23,27,"pl-smi"]],[],[],[[12,14,"pl-k"]],[[31,35,"pl-smi"]],[[13,17,"pl-k"],[18,20,"pl-k"]],[[31,35,"pl-smi"]],[],[],[],[],[],[[8,12,"pl-k"],[13,19,"pl-en"]],[[12,18,"pl-c1"]],[[12,18,"pl-k"]],[],[],[[8,12,"pl-k"],[13,24,"pl-en"]],[[12,18,"pl-c1"]],[[12,22,"pl-c1"]],[],[],[[14,25,"pl-en"]],[[12,18,"pl-k"]],[],[],[[8,12,"pl-k"],[13,23,"pl-en"]],[[12,18,"pl-c1"]],[],[],[[8,12,"pl-k"],[13,18,"pl-en"]],[],[[12,17,"pl-k"],[21,25,"pl-c1"]],[[24,27,"pl-s"],[24,25,"pl-pds"],[26,27,"pl-pds"],[34,37,"pl-smi"],[41,44,"pl-s"],[41,42,"pl-pds"],[43,44,"pl-pds"],[51,56,"pl-smi"],[60,64,"pl-s"],[60,61,"pl-pds"],[63,64,"pl-pds"]],[[23,27,"pl-smi"]],[],[],[],[],[],[],[],[[0,5,"pl-k"],[6,14,"pl-en"]],[],[[4,12,"pl-k"]],[[8,36,"pl-c"],[8,10,"pl-c"]],[],[[8,49,"pl-c"],[8,10,"pl-c"]],[[12,15,"pl-k"]],[[8,34,"pl-c"],[8,10,"pl-c"]],[[8,11,"pl-k"]],[],[[4,11,"pl-k"]],[[8,16,"pl-en"],[17,20,"pl-k"]],[[12,16,"pl-c1"],[18,26,"pl-smi"]],[],[[8,12,"pl-k"],[13,18,"pl-en"]],[[22,27,"pl-c1"]],[],[],[[8,11,"pl-k"],[12,15,"pl-en"],[16,19,"pl-k"]],[[12,73,"pl-c"],[12,14,"pl-c"]],[[12,14,"pl-k"],[25,29,"pl-c1"],[47,50,"pl-c1"]],[[26,37,"pl-c1"]],[[16,22,"pl-k"],[38,43,"pl-smi"]],[],[[12,18,"pl-k"],[20,21,"pl-c1"]],[],[],[],[[8,12,"pl-k"],[13,16,"pl-en"],[17,20,"pl-k"],[26,29,"pl-k"]],[[12,65,"pl-c"],[12,14,"pl-c"]],[[12,14,"pl-k"],[25,29,"pl-c1"],[47,50,"pl-c1"]],[],[[19,24,"pl-smi"]],[[26,37,"pl-c1"]],[[13,17,"pl-k"]],[[16,58,"pl-c"],[16,18,"pl-c"]],[[42,52,"pl-c1"]],[[16,63,"pl-c"],[16,18,"pl-c"]],[[16,18,"pl-k"],[30,34,"pl-c1"]],[[20,23,"pl-k"],[40,51,"pl-c1"],[55,58,"pl-smi"]],[[29,34,"pl-c1"]],[[30,40,"pl-c1"]],[],[],[],[],[],[],[[0,3,"pl-k"],[4,8,"pl-en"],[9,12,"pl-k"],[19,23,"pl-k"]],[],[],[[4,6,"pl-c"],[4,6,"pl-c"]],[[0,18,"pl-c"]],[[0,15,"pl-c"]],[[0,14,"pl-c"]],[[0,15,"pl-c"]],[[0,14,"pl-c"]],[[0,13,"pl-c"]],[[0,14,"pl-c"]],[[0,15,"pl-c"]],[[0,14,"pl-c"]],[[0,15,"pl-c"]],[[0,14,"pl-c"]],[[0,13,"pl-c"]],[[0,14,"pl-c"]],[[0,0,"pl-c"]],[[0,32,"pl-c"]],[[0,6,"pl-c"],[4,6,"pl-c"]],[[4,9,"pl-c1"],[10,14,"pl-c1"],[15,16,"pl-c1"]],[],[[4,7,"pl-k"],[19,20,"pl-c1"]],[[4,7,"pl-k"],[26,28,"pl-c1"]],[[4,6,"pl-k"],[13,14,"pl-c1"]],[[19,23,"pl-c1"],[29,30,"pl-c1"]],[],[[4,6,"pl-k"],[13,14,"pl-c1"]],[[26,30,"pl-c1"],[36,37,"pl-c1"]],[],[],[[13,18,"pl-smi"]],[],[[4,7,"pl-k"]],[[4,7,"pl-k"],[8,11,"pl-k"],[14,15,"pl-c1"]],[[14,34,"pl-c"],[14,16,"pl-c"]],[[16,22,"pl-s"],[16,17,"pl-pds"],[21,22,"pl-pds"],[31,35,"pl-s"],[31,32,"pl-pds"],[34,35,"pl-pds"]],[[14,17,"pl-c1"]],[[14,19,"pl-c1"]],[],[[12,16,"pl-c1"]],[[16,22,"pl-s"],[16,17,"pl-pds"],[21,22,"pl-pds"],[31,35,"pl-s"],[31,32,"pl-pds"],[34,35,"pl-pds"],[45,48,"pl-c1"]],[[14,19,"pl-c1"]],[],[],[],[[4,10,"pl-k"],[11,12,"pl-c1"]],[]],"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/bigxing/leetcode/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"LRUCache.cpp","displayUrl":"https://github.com/bigxing/leetcode/blob/master/src/LRUCache/LRUCache.cpp?raw=true","headerInfo":{"blobSize":"5.98 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"fe4a459","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fbigxing%2Fleetcode%2Fblob%2Fmaster%2Fsrc%2FLRUCache%2FLRUCache.cpp","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"253","truncatedSloc":"207"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"C++","languageID":43,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/bigxing/leetcode/blob/master/src/LRUCache/LRUCache.cpp","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/bigxing/leetcode/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/bigxing/leetcode/raw/refs/heads/master/src/LRUCache/LRUCache.cpp","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/bigxing/leetcode/branches":{"post":"FglqwYZhLIDfPuDMrVLnfO6Ak9LwK_wId_Tu3OxuKy28baoS4ZnXXBhBakp4A-Ce33adyUWIa4nqQMya1ZO4tw"},"/repos/preferences":{"post":"jsOuFyXQzDW0vLvsMVEd0Jp8L2wScxLKPQOe-oZXwoesW4nMTFJqMnwvtGuha0sRiGnpr2-3KDJMXqlX_UMmZw"}}},"title":"leetcode/src/LRUCache/LRUCache.cpp at master · bigxing/leetcode","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1b17b3e7786a.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0