Simulation volume Leetcode [general] 731 My schedule II

731. My schedule II Implement a MyCalendar class to store your schedule. If the time to be added does not result in triple bookings, you can store the new schedule. MyCalendar has a book(int start, int end) method. It means adding a schedule within the time from start to end. Note that the time here is a semi open interval, i.e. [start, end]. ...

Posted by jeet_0077 on Sat, 02 Apr 2022 04:19:17 +0300

LeetCode's notes on writing questions: sum of two numbers (simple)

Learn algorithm, brush force buckle, refueling roll, enter the big factory! Title Description Force button title link Given an integer array nums and an integer target value target, please find the two integers with and as the target value target in the array and return their array subscripts. You can assume that each input will correspond ...

Posted by shoutdots on Sat, 02 Apr 2022 00:36:56 +0300

C/C + + Programming: STL heap learning

sketchy description heap is not an STL container component. It is a hero behind the scenes and plays the assistant of priority queue.priority queue allows users to push any element into the container in any order, but it must be accessed from the element with the highest priority. Why use heap as the underlying mechanism of priority queue? I ...

Posted by stuart7398 on Fri, 01 Apr 2022 11:52:15 +0300

Bracket generation. (recursion, deep search, backtracking, graph traversal, dynamic programming)

subject 22. Bracket generation Medium difficulty The number n represents the logarithm of the generated parentheses. Please design a function to generate all possible and effective combinations of parentheses.   Example 1: Input: n = 3 Output:["((()))","(()())","(())()","()(())","()()()"] Example 2: Input: n = 1 Output:["()"]   Ti ...

Posted by namasteaz on Fri, 01 Apr 2022 00:10:51 +0300

Byte campus selected 66 high-frequency Classic Pen questions (including a variety of ideas)

preface The algorithm link comes from Sprint spring move - selected pen interview 66 questions pass The following is my study notes and summary, which is also convenient for others to browse more quickly first day 21. Merge two ordered linked lists (simple) Merge the two ascending linked lists into a new ascending linked list and ret ...

Posted by pearjam on Thu, 31 Mar 2022 21:26:15 +0300

leetcode notes 15 - hash table

leetcode notes 15 - hash table For an introduction to hashing, please refer to [XJTUSE] data structure learning - hash (hash) Valid Letter outliers subject Given two strings s and t, write a function to judge whether t is an alphabetic ectopic word of s. Note: if each character in S and t appears the same number of times, s and T a ...

Posted by methodman on Thu, 31 Mar 2022 17:27:17 +0300

[rookie training] sword finger Offer 63 Maximum profit of stock

Title Description: Suppose the price of a stock is stored in the array in chronological order. What is the maximum profit that can be obtained from buying and selling the stock at one time? Example 1: Input: [7,1,5,3,6,4] Output: 5 Explanation: buy on day 2 (stock price = 1) and sell on day 5 (stock price = 6). Maximum profit = 6-1 = 5. Note ...

Posted by Illusion on Thu, 31 Mar 2022 07:54:04 +0300

leetcode depth first search, breadth first search and joint search

1, Popular explanation: source Depth first can think like this. A person gets lost and meets many forks. He has only one person and wants to go out, so he can only try one by one. When one road goes to the dark, he finds the end, and then turn back to the other forks of the road just now. Finally, he finds that all the forks of the road have be ...

Posted by jax_15 on Wed, 30 Mar 2022 21:36:20 +0300

LeetCode151. Reverse word + icon in string

Flip the words in the string Given a string, flip each word in the string one by one. explain: Characters without spaces form a word. The input string can contain extra spaces before or after, but the inverted characters cannot be included. If there is extra space between two words, reduce the space between words after inversion to only one. ...

Posted by a1ias on Tue, 29 Mar 2022 23:38:36 +0300

[LeetCode Hot100] 617. Merge binary tree

Here are two binary trees: root1 and root2. Imagine that when you overlay one tree over the other, some nodes on the two trees will overlap (while others won't). You need to merge the two trees into a new binary tree. The merging rule is: if two nodes overlap, add the values of the two nodes as the new values of the merged nodes; Otherwise, th ...

Posted by ben_johnson1991 on Tue, 29 Mar 2022 16:57:53 +0300