• Leetcode 124. Maximum path and | Python in binary tree


    124. Maximum path sum in binary tree Title Source: leetcode https://leetcode-cn.com/problems/binary-tree-maximum-path-sum subject Given a nonempty binary tree, the maximum path sum is returned. In this problem, the path is defined as a sequence from any node in the tree to any node. The path contains at least one node and does not necessarily pass through […]

  • I don’t know you when I’m dressed? Let’s talk about the longest ascending subsequence


    The longest ascending subsequence is a classical algorithm problem. Some will ask you to find the longest ascending subsequence directly, others will put it another way, but the final investigation is the longest ascending subsequence. So the problem is, you can still see it in clothes, can’t you? If you can’t see it at all, […]

  • Leetcode 67. Binary summation | Python


    67. Binary summation Title Source: leetcode https://leetcode-cn.com/problems/add-binary subject Give you two binary strings and return their sum (in binary). The input is a non empty string and contains only the numbers 1 and 0. Example 1: Input: a = – 11 “, B = – 1” Output: “100” Example 2: Input: a = – 1010 […]

  • Algorithm – a classic SQL problem and a Java algorithm problem


    1. SQL question description In other words, there is a log table with only two columns, namely continuous ID and num. as for what it means, treat it as the amount. Now if you want to know num for 3 times or more, the data is as follows id num 1 1 2 1 3 […]

  • Implementation of LRU algorithm in Java


    Recently, I met Alibaba’s outsourcing company, but I have to knock the code online. That’s a tension. The topic is to implement a cache of LRU algorithm. Outsourcing is so demanding, eh. Fortunately, LRU is a topic assigned by my university teacher. Of course, I implemented it in C language. The principle of the algorithm […]

  • In situ hash


    Example: missing first positive number Source: leetcode Link:https://leetcode-cn.com/probl… In situ hash Example: Missing first positive number Difficulty: hard describe To give you an unsorted integer array, please find the smallest positive integer that does not appear in it. Examples Example 1: Input: [1,2,0] Output: 3 Example 2: Input: [3, 4, – 1, 1] Output: 2 […]

  • 【leetcode】127. Word Ladder


    Main idea: Give a start word beginword and an end word Endword, and then give a word list wordlist. From beginword to Endword, only one letter can be changed at a time, and the word is wordlist. Solutions: In fact, it is a disguised BFS. It looks for the adjacent words that can be transformed […]

  • Algorithm – list operation topic routine


    0. Preface Simple topics, but without practice or recitation, may not be able to write out. In an interview, you often finish them in a short time. You don’t have time to draw pictures and deduce them. These can only be quickly completed in your mind. Sometimes after a long time, you feel that you […]

  • Split string


    Leetcode-165For example, the first thing to do in this topic is to divide the string by ‘. Here are two ways I summarize to split strings.Firstly, istringstream and getline are used for segmentation string version1 = “”; vector<int> v1; istringstream s1(version1); string temp; while(getline(s1,temp,’.’)){ v1.push_back(stoi(temp)); } Secondly, there is a fool’s solution string version1 = […]

  • C practical exercise topic 5


    Title:Input three integers x, y, Z, please output these three numbers from small to large. Program analysis:We try to find a way to put the minimum number on X. first, we compare x with y. if x > y, we exchange the value of X with y, and then we compare x with Z. if […]

  • I picked your clothes – the longest public subsequence


    I didn’t know you when I put on my clothes? Let’s talk about the longest ascending subsequence, which has received unanimous praise. Today, we are still bringing you the skin changing topic – the longest common subsequence series. The longest common subsequence is a classical algorithm problem. Some will directly ask you to find the […]

  • “The virtue of laziness” I wrote a script for automatically generating index for documents in Python


    I used Python to write a script to generate index automatically Introduction: in order to solve the algorithm problems, a GitHub warehouse is builtPiperLiu / ACMOI_JourneyRecord their own brush topic track, and summarize the method, experience. Think of a requirement: can I use the program to automatically classify and create an index after I add […]