The interviewer asked me to go back and look at the first question.

⭐ Introduction ⭐ Neodymium Hi everyone, I'm stuck. Today we are explaining the series of classical sums. It's good to say that some people can't do the first thing while watching the sea at night. You should all know that the first question of power button is the sum of two numbers. But in fact, the sum of two numbers is only the beginning. I ...

Posted by greatepier on Thu, 30 Dec 2021 23:03:46 +0100

Calculation of 399 division of force deduction problem

Give you a variable pair array equations and a real value array values as known conditions, where equations[i] = [Ai, Bi] and values[i] jointly represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string representing a single variable. There are also some problems represented by array queries, where queries[j] = [Cj, Dj] represents t ...

Posted by sanlove on Thu, 30 Dec 2021 22:37:59 +0100

3, Common usage of STL string

1, string introduction Header file #include<string> using namespace std; 2, Definition of string Defining a string is the same as the basic data type. You only need to follow the variable name after the stringInitialization can be achieved directly by assigning a value to a variable of type string string str; string str = "abc"; 3 ...

Posted by dodgyJim on Thu, 30 Dec 2021 21:24:10 +0100

[data structure and algorithm] LeetCode single linked list exercise

Reverse linked list ​ Title link here Three pointers: Problem solving ideas: First analyze the special case. When the linked list is empty or there is only one node, directly return to head When there are more than one node in the linked list, we first consider whether we can reverse the pointer in turn, so as to reverse the linked list ...

Posted by quetz67 on Thu, 30 Dec 2021 11:13:37 +0100

LeetCode 96. Different binary search trees

Title Description Give you an integer n and find how many kinds of binary search trees are composed of exactly n nodes with different node values from 1 to n? Returns the number of binary search trees that meet the meaning of the question. Example: Input: n = 3 Output: 5 dynamic programming thinking Given an ordered sequence 1 * ...

Posted by hadingrh on Thu, 30 Dec 2021 07:36:28 +0100

Force deduction method 1705 - maximum number of apples to eat

Original title link: Force buckle Description: There is a special apple tree, which can grow several apples every day for n days. On day I, apples[i] will grow on the tree. These apples will rot and become inedible after days[i] (that is, on day i + days[i]). It is also possible that new apples will not grow on the tree for a few days. At th ...

Posted by Atari on Wed, 29 Dec 2021 21:50:10 +0100

LeetCode brushing day 6 (string arrangement)

subject Give you two strings s1 and s2 and write a function to determine whether s2 contains the arrangement of s1. In other words, one of the permutations of s1 is a substring of s2. Example 1: Input: s1 = "ab" s2 = "eidbaooo" Output: true Explanation: s2 contain s1 One of the permutations of ("ba"). Example 2: Input: s1= "ab" s2 = ...

Posted by jblack on Wed, 29 Dec 2021 08:45:06 +0100

Maximum subarray sum (maximum sum of continuous subarrays) -- Fundamentals

Maximum subarray sum (dynamic programming, divide and conquer): The solution of this problem is only for personal understanding. If there are other ideas or solutions, welcome to explore! Buckle link: Maximum sum of consecutive subarrays Title: Enter an integer array. One or more consecutive integers in the array form a sub array. ...

Posted by ihw13 on Tue, 28 Dec 2021 15:05:33 +0100

LeetCode - Sword finger Offer learning plan

stay Personal blog Synchronize updates in Day 1 stack and queue (simple) Sword finger Offer 09 Queue with two stacks class CQueue { public: CQueue() { } stack<int>s1,s2; void appendTail(int value) { s1.push(value); } int deleteHead() { if(s2.empty()) { while(!s1.empty()) ...

Posted by wanda46 on Tue, 28 Dec 2021 13:53:42 +0100

LeetCode - 825 - school-age friends - Java - in the author's opinion, it's fine

subject   Topic analysis   Problem solving thinking 1: Sorting the array ages (in ascending order) is actually sorting these people according to their age from high to low. At this time, use two "left and right pointers" to lock x's dating range. After confirmation, right - left is the number of people who meet th ...

Posted by niranjnn01 on Tue, 28 Dec 2021 07:25:44 +0100