Tag:The sum

  • Leetcode depth first algorithm tree (path dependent)


    Leetcode depth first algorithm tree (path dependent) Tree problems can generally be solved by depth first algorithm and breadth first algorithm. Path related problems can generally be implemented by DFS or backtracking algorithm based on DFS. We review and train DFS and backtracking algorithm through the following questions. 112. path sum describe Given a binary […]

  • Study day 5.2


    C language If — the representative statement and judgment condition of the selection structure if If else if else if else、 int num = 100; int cost = 0; if (num > 200) cost = 1; else if (num > 300) cost = 2; else if (num > 80) cost = 3; else if (num […]

  • Aggregate function


    MySQL # provides many functions Count: count,frequency,nullNo statistics Max:Maximum Min:minimum value Sum:Sum Avg:average value Round:rounding   Aliases are usually given when using aggregate functions   9.6.1 countfunction ##countfunction count(*):Will not ignorenullValue of. #(1)InquiryempNumber of records in the table Select count(*) from emp;    ##(2)StatisticsempIn the table, the number of people with Commission ##count(Specific field),nullThe value is […]

  • Acwing week 16


    Uniform case According to the meaning of the title1. Count the number of upper and lower case letters2. Convert to lowercase or uppercase as required and output #include #include #include using namespace std; Bool check (char c) {// judge case if(c>=’a’ && c<=’z’) return 1; else return 0; } string s; int t; int main(){ […]

  • Application of LDA topic model algorithm in Python


    Original link:http://tecdat.cn/?p=5318 In this article, I will introduce the installation and basic usage of LDA Python package for late Dirichlet allocation (LDA). I will not introduce the theoretical basis of this method in this article. The main idea of assigning documents in corpus (document set) to potential (hidden) topics based on word vectors is quite […]

  • [leetcode] 561. Array splitting I


    Given an array of 2n in length, your task is to divide these numbers into n pairs, such as (A1, B1), (A2, B2),…, (an, BN), so as to maximize the sum of min (AI, BI) from 1 to n. Example 1:Input: [1,4,3,2]Output: 4Explanation: n is equal to 2, and the maximum sum is 4 = […]

  • Final width calculation of sub elements in flex layout


    I used to have a colleague who liked to use it in layoutflexLayout, can use flex, he uses flex, and he is using itflexI always like the layoutLayout of side gateIt’s hard to figure out the final width of elements, such as: .box{ display: flex; width: 600px; height: 300px; } .box .left { flex: 1 […]

  • Leetcode Weekly – 174 – 3


    1339. Maximum product of split binary trees Hi, everyone. I’m a pig. Welcome to the weekly leetcode quiz of the “baby can understand” series. This is the third question in 174 and 1339 in the list of topics – “the maximum product of a split binary tree.” Title Description Here is a binary tree whose […]

  • [leetcode 477] PHP calculates the sum of Hamming distances


    Link to the original text: he Xiaodong’s blog PHP calculates the sum of Hamming distances The Hamming distance of two integers refers to the number of different bits corresponding to the binary number of the two numbers. Calculate the sum of Hamming distances between any two numbers in an array. Example: Input: 4, 14, 2 […]

  • C practical exercises 45


    Title:Learn how to use register to define variables. Program analysis:None. example: #include int main() { register int i; int tmp=0; for(i=1;i<=100;i++) tmp+=i; Printf (“sum is% D, TMP)”; return 0; } The output results of the above examples are as follows: The total is 5050 Thank you for your reading, please feel with your heart! Hope […]

  • leetcode477. Total Hamming Distance


    Topic requirements The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total Hamming distance between all pairs of the given numbers. Example: Input: 4, 14, 2 Output: 6 Explanation: In binary representation, the 4 is 0100, 14 is 1110, […]

  • 64. Minimum path sum


    Given a m x n grid with nonnegative integers, find a path from the top left corner to the bottom right corner, so that the sum of the numbers on the path is the minimum. Note: you can only move down or to the right one step at a time. Example: Input:[  [1,3,1], [1,5,1], [4,2,1]]Output: […]