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

Sprint spring move - selected pen interview 66 questions day22 (end)

day22 topic: 151. Reverse the words in the string,46. Full arrangement,2. Add two numbers Today's knowledge points: string, recursion and linked list. The difficulty is medium, medium and medium Learning plan link: Sprint spring move - selected pen interview 66 questions pass Yesterday's topic link: Sprint spring move - selected pen intervie ...

Posted by wefollow on Tue, 29 Mar 2022 13:55:22 +0300

hugging face tutorial - Chinese Translation - create a custom architecture

Create a custom schema AutoClass automatically deduces the model architecture and downloads the pre trained configuration and weight. In general, we recommend using AutoClass to generate code independent of checkpoints. However, users who want more control over specific model parameters can create custom Transformers models from several base c ...

Posted by Jtech inc. on Tue, 29 Mar 2022 10:14:46 +0300

Problem solving ideas of binary tree / n-ary tree

Binary tree The characteristic of binary tree is that each node can only have two subtrees at most, which can be divided into left and right The data structure of binary tree is as follows: public class TreeNode { //Value of node int val; //Left subtree TreeNode left; //Right subtree TreeNode right; TreeNode(int x) { val ...

Posted by cnl83 on Mon, 28 Mar 2022 16:25:20 +0300

leetcode brush 572 The subtree of another tree, Easy (Java) DFS & violence + DFS&KMP

1. Title Description Here are two binary trees, root and subRoot. Check whether the root contains subtrees with the same structure and node values as the subRoot. If it exists, return true; Otherwise, false is returned. A subtree of a binary tree tree includes a node of the tree and all descendants of this node. A tree can also be regarde ...

Posted by jayjay960 on Mon, 28 Mar 2022 15:45:33 +0300