Open the turntable lock

1, Title Description You have a turntable lock with four round wheels. Each wheel has 10 digits: "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9". Each paddle wheel can rotate freely: for example, change "9" to "0" and "0" to "9". Each rotation can only rotate one digit of one dial wheel. TUTF-8...

Posted by xsgatour on Fri, 02 Jul 2021 06:39:39 +0930

Leetcode 146: LRU cache mechanism -- hash table + bidirectional linked list solution with detailed notes

Title Description Design and implement an LRU (least recently used) caching mechanism with your data structure. Implement the LRUCache class: LRUCache(int capacity) initializes the LRU cache with a positive integer as the capacityint get(int key) if the key exists in the cache, the value of theUTF-8...

Posted by vocoder on Tue, 06 Jul 2021 02:50:01 +0930

leetcode -- two interesting array problems

Question 1 Given an array, move the elements in the array K positions to the right, where k is a non negative number. Example 1: input: nums = [1,2,3,4,5,6,7], k = 3 output: [5,6,7,1,2,3,4] explain: Rotate 1 step to the right: [7,1,2,3,4,5,6] Rotate 2 steps to the right: [6,7,1,2,3,4,5] Rotate UTF-8...

Posted by jasons61 on Thu, 08 Jul 2021 03:14:26 +0930

Binary tree before, after the order traversal summary, python recursive method and iterative method

As for the preoder, inorder and postorder traversal of binary tree, we just need to remember that the left child node must be on the left (left and right) of the right child node. The so-called preorder, inorder and postorder traversal means that the positions of the root nodes are different. PUTF-8...

Posted by gravedig2 on Thu, 08 Jul 2021 06:04:13 +0930

Introduction to data structure

preface Data structure is the basic skill of programmer. Program = data structure + algorithm. This chapter is my own learning record 1, Introduction to data structure Different data structures have their own usage scenarios, The purpose is to reduce the time complexity and space complexity. GUTF-8...

Posted by phpian on Sun, 11 Jul 2021 07:44:35 +0930

Open turntable lock (medium) | BFS

PS: You think it's A medium problem, but the official solution uses A * algorithm. There is no ready-made data structure. It's no less difficult to implement it in C language. Ha ha, no wonder you don't even bother to write the C version in the implementation of the official answer A * algoritUTF-8...

Posted by israely88 on Mon, 12 Jul 2021 03:04:54 +0930

LeetCode - 218. The Skyline Problem [Difficulty] - Analysis and Code (Java)

1. Title The skyline of a city is the outline of the outline formed by all the buildings in the city from a distance.Give you the locations and heights of all the buildings, and return to the skyline formed by them. The geometric information for each building is represented by an array of builUTF-8...

Posted by NArc0t1c on Tue, 13 Jul 2021 05:40:51 +0930

How to master MYSQL quickly? Detailed explanation of 50 database topics with the highest frequency in LeetCode

How to master MYSQL quickly? How to be familiar with SQL to meet the needs of daily work? If you don't know anything at present, just stay at the level of knowing that SELECT is used for query, and want to quickly master MYSQL, then brushing questions, and there is nothing to supplement in the UTF-8...

Posted by EcLip$e on Wed, 14 Jul 2021 02:45:48 +0930

csdn algorithm and code summary

1. Dynamic programming Introduction of dynamic programming 1, Basic ideas Generally speaking, as long as the problem can be divided into smaller word problems, and the optimal solution of the original problem contains the optimal solution of the subproblem, dynamic programming can be considereUTF-8...

Posted by 3yoon af on Wed, 14 Jul 2021 05:55:47 +0930

Learning series of leetcode question bank

Original address: https://leetcode-cn.com/leetbook/read/queue-stack/kbcqv/ The problem is located in the queue, breadth first search under the learning problem. The original title is as follows: Here is a two-dimensional grid composed of '1' (land) and '0' (water). Please calculate the number oUTF-8...

Posted by lookee on Thu, 15 Jul 2021 06:39:06 +0930