leetcode
Title address: https://leetcode.com/problems/count-different-palindromic-subsequences/ Given a length n n String of n s s s. Find the number of all different non empty palindrome subsequences. Two subsequences are different if and only if their letter composition is different (or different lettUTF-8...
Posted by phptrack on Fri, 16 Jul 2021 07:25:15 +0930
Find the number I in the sorted array Direct link: https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/ Count the number of times a number appears in the sorted array. Example 1: Input: nums = [5,7,7,8,8,10], target = 8 Output: 2 Examples 2: Input: nums = [5,7,7,8,8,10UTF-8...
Posted by angryjohnny on Sat, 17 Jul 2021 06:40:12 +0930
The content of this paper is based on the interview algorithm LeetCode class of Xiaoxiang College, Lin Mu, and will be updated irregularly in the future! 5. Binary tree and graph The sum of leetCode 113 paths 2 This topic has defined a tree node type structure in advance struct TreeNode { int vUTF-8...
Posted by evan12 on Sun, 18 Jul 2021 09:00:55 +0930
Stack and queue 1 queue First in first out data structure Design queue class MyCircularQueue { public: int *queue; int size; int maxSize; MyCircularQueue(int k) { size=0; maxSize=k; queue=new int[k]; } bool enQueue(int value) { if(size>=maxSize) return false; queue[size++]=value; return true; }UTF-8...
Posted by youngsei on Tue, 20 Jul 2021 04:34:39 +0930
Topic link LRU cache mechanism Title Description Pay attention When the cache capacity reaches the maximum, it should delete the longest unused data value before writing new data, so as to make room for new data values Solutions Explanation of LRU cache mechanismYou need to get the value accordUTF-8...
Posted by sintax63 on Tue, 20 Jul 2021 07:45:41 +0930
The algorithm I have written for this series of blog puzzles is not necessarily the best solution for time and space complexity. All puzzles are based on the principle that AC and algorithm templates are universal. First of all, the list of additions and deletions are checked. All the problems UTF-8...
Posted by mort on Wed, 21 Jul 2021 01:34:59 +0930
Everything is searchable Depth traversal search When the depth first search (DFS) searches a new node, it immediately traverses the new node; Therefore, traversal needs to be implemented by first in and then out stack, or by recursion equivalent to stack. For the tree structure, since traversaUTF-8...
Posted by jtbaker on Wed, 21 Jul 2021 08:19:51 +0930
1. Title Give you a chain list of length n, each node containing an additional random pointer to any node in the chain or to an empty node. Construct this list of chains Deep copy. The deep copy should consist of exactly n new nodes, where each new node's value is set to the value of its correUTF-8...
Posted by mickwaffle on Thu, 22 Jul 2021 02:10:58 +0930
Title Description Here are the head nodes of two single linked lists, headA and headB. Please find out and return the starting node where the two single linked lists intersect. If there is no intersection between two linked lists, null is returned. The two linked lists begin to intersect at nodUTF-8...
Posted by Jay on Thu, 22 Jul 2021 02:14:49 +0930
This article is the author's notes on LeetCode. The whole article is divided into two parts: 1. The algorithm and code of my own thinking. 2. The optimal algorithm and code given by LeetCode. By comparing the similarities and differences between the two parts of algorithm and code, the author'sUTF-8...
Posted by karimali831 on Thu, 22 Jul 2021 03:50:56 +0930