Binary tree of leetcode

The key of recursive algorithm **First of all: define the function clearly. Trust this definition. Don't * * jump into recursion. **Secondly: * * find out what the root node wants to do, and then select the first, middle and last recursive framework according to the topic requirements. **Finally: * * think out what each node needs to do and ...

Added by kidd1270 on Fri, 12 Nov 2021 01:36:26 +0200

225. Implement stack with queue

225. Implement stack with queue Title Link: 225. Implement stack with queue (simple) Title Description Please use only two queues to implement a last in first out (LIFO) stack, and support all four operations of the ordinary stack (push, top, pop and empty). Implement MyStack class: void push(int x) pushes element X to the top of the stack. ...

Added by bidntrade on Thu, 11 Nov 2021 03:28:43 +0200

LeetCode daily question 488. Zuma game

488. Zuma game You are participating in a variant of Zuma game. In this Zuma game variant, there is a row of colored balls on the table. The color of each ball may be red 'R', yellow 'Y', blue 'B', green 'G' or white 'W'. You also have some colored balls in your hand. Your goal is to empty all the balls on the table. Each round: Choose any o ...

Added by TLawrence on Wed, 10 Nov 2021 22:15:39 +0200

[completion algorithm] merge two ordered linked lists

Merge two ordered linked listsLeetCode21. Merge two ordered linked listsProblem descriptionInput two monotonically increasing linked lists and output the synthesized linked list. We need the synthesized linked list to meet the monotonic non decreasing rule.Example:Input: {1,3,5}, {2,four,6}Return value: {1,2,3,4,5,6}Analyze problemsSince the gi ...

Added by tam2000k2 on Mon, 08 Nov 2021 14:53:10 +0200

Day9 learning record

1. Sum of three numbers Source: LeetCode Link: https://leetcode-cn.com/problems/3sum Code: learn Wu Yanzu's solution Give you an array num containing n integers. Judge whether there are three elements a, b and c in num, so that a + b + c = 0? Please find all triples with sum 0 and no repetition. class Solution: def threeSum(self, nums: List ...

Added by reli4nt on Sat, 06 Nov 2021 22:34:14 +0200

leetcode33 -- search rotation sort array

reference resources: https://www.cnblogs.com/gzshan/p/12570332.html 1, Rotate array Corresponding to 43 questions of Niuke 1. Title There is a shift instruction in assembly language called cyclic left shift (ROL). Now there is a simple task to simulate the operation result of this instruction with a string. For a given character sequence S, ...

Added by LanceT on Sat, 06 Nov 2021 21:43:16 +0200

Algorithm design competition T18

Finally, the last question, because this question has really been tried many times and can't pass the test, so I'll write the later one first and come back to fill in this question. ok, the following is the only two difficult questions in this preliminary contest, which is also the last one, similar string group T18 if two letters at differ ...

Added by ryanpaul on Sat, 06 Nov 2021 14:53:56 +0200

LeetCode268. Missing numbers

268. Missing numbers Given an array num containing N numbers in [0, n], find the number that does not appear in the array within the range of [0, n]. Example 1: Input: nums = [3,0,1] Output: 2 Explanation: n = 3,Because there are three numbers, all the numbers are in the range [0,3] Inside. 2 is the missing number because it does not appea ...

Added by buildakicker on Sat, 06 Nov 2021 12:01:19 +0200

Two problems of merging and dividing leetcode linked list

1. Merge two ordered linked lists 1.1 Title Description This topic comes from leetcode 21. Merging two ordered linked lists Tips: 1.2 interface function /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* mergeTwoLists(struct ListNode* l1, struct ...

Added by B34ST on Sat, 06 Nov 2021 07:36:12 +0200

Force button brush problem list No. 2 precise solution of adding two numbers

0. Title link Force buckle   1. Topic analysis 2. Add two numbers Medium difficulty 7007 Here you are   Non empty   A linked list that represents two nonnegative integers. Each of these numbers is based on   Reverse order   And each node can only store   One   Number. Please add the two numbers and return ...

Added by ramez_sever on Sat, 06 Nov 2021 01:27:43 +0200