Introduction to linked list of data structure

preface The common skill of linked list exercises is to define pointers to replace head. If you go for head, it is either a mathematical problem. The circular linked list is solved by using mathematical ideas, or it is to define double pointers to operate the linked list. 1, Delete the node with the given value of key in the linked li ...

Added by upperbid on Tue, 11 Jan 2022 00:02:33 +0200

Leetcode.863. Enhancement of all K-distant nodes in a binary tree --- Further understanding of tree width, recursive reverse node finding, and function

0. Preface The brushing algorithm clocked in for the sixth day and today picked up a moderate problem. But with the precipitation knowledge of the previous problem solving, it doesn't feel too painful to solve today. But there is something new to settle, so this is a record. That's how the brushing algorithm works. It's okay in general ...

Added by krishnam1981 on Mon, 10 Jan 2022 20:04:22 +0200

leetcode-190. Invert Binary Bits

Reverses the binary bit of a given 32-bit unsigned integer. Tips: Note that in some languages, such as Java, there are no unsigned integer types. In this case, both input and output are specified as signed integer types and should not affect your implementation, since the internal binary representation of integers is the same whether they are ...

Added by Swerve1000 on Mon, 10 Jan 2022 19:11:21 +0200

The dichotomy of Leetcode's notes

278. First wrong version Simple difficulty 259 You are a product manager and are currently leading a team to develop new products. Unfortunately, the latest version of your product has not passed the quality test. Since each version is developed based on the previous version, all versions after the wrong version are wrong. Suppose you hav ...

Added by cmancone on Mon, 10 Jan 2022 18:39:27 +0200

Queue of Leetcode brush notes

27. Remove element Give you an array num and a value val, you need In situ Removes all elements with a value equal to val and returns the new length of the array after removal. Do not use extra array space, you must only use O(1) extra space and In situ Modify the input array. The order of elements can be changed. You don't need to consi ...

Added by dsp77 on Mon, 10 Jan 2022 18:27:16 +0200

Daily practice (day01)

preface Today is the first day, so let's simply send it to the topic to play, not for anything else, just for pleasure. Although this is a simple topic, I didn't expect that I didn't pay attention to several variables. I was stunned and adjusted for a long time. You should be more careful. Sum of two numbers Given an integer array num ...

Added by johnnycsh on Mon, 10 Jan 2022 07:23:16 +0200

Gray code / 1046 The weight of the last stone

This problem is a simulation. I know that the solution must use bit operation, but it won't be. It's uncomfortable. Record my stupid thinking than simulation (java takes 41ms, really slow), and then calculate honestly. Idea: 1. First of all, there is an interesting rule for gray codes, that is, the first n gray codes of n+1 bits are positi ...

Added by chelsea7 on Sat, 08 Jan 2022 10:21:34 +0200

LeetCode array brush question 1

704. Binary search Title: Topic analysis: Give an array and target value, find the location of the target value, and return the array subscript of the location. If there is no target value in the array, return - 1 The moment I see the problem, I think I can directly a for loop. I can finish writing and finish work directly. I can see ...

Added by The Merg on Sat, 08 Jan 2022 08:02:19 +0200

Rehabilitation type force buckle brushing notes d3

catalogue Small diary written in front Code part Question 1576 Question 26 Question 27 Question 5 java small knowledge part Question 1576 Question 27 Question 5 Small diary written in front Changed the c-plane and power supply for the notebook. Finally, it can support me to press the n key smoothly and use the computer without plug ...

Added by joshblue on Thu, 06 Jan 2022 13:38:12 +0200

[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "different binary search tree II"

1, Title Requirements Give you an integer n, please generate and return all different binary search trees composed of N nodes with different node values from 1 to N, and you can return the answers in any order.Example 1: Input: n = 3 Output:[[1,null,2,null,3],[1,null,3,2],[2,1,3],[3,1,null,null,2],[3,2,null,1]] Example 2: Input: n = 1 ...

Added by waiwai933 on Thu, 06 Jan 2022 08:00:17 +0200