Tag：integer

[animation notes] rolling Division — find the maximum common divisor and the minimum common multiple
Recently, I touched up the C language and tried to write a calculation tool in combination with the recently learned operations research. On the way, I met a demand: score reduction. How to get the score in one step? The answer is to find the denominator and numeratorgreatest common divisor。 So how to calculate the […]

Arithmetic operation and relation operation of C + + pointer
The following essay is about the arithmetic operation and relational operation of the pointer. Arithmetic operation of pointer type Addition and subtraction of pointer and integer Pointer + +, – operation Arithmetic operation of pointer type Pointer P Plus or minus n Its meaning is that the pointer points to the starting position of the […]

Algorithm interview question 3: the intersection of two arrays, add one and move zero
Here is a personal solution to the intersection of two arrays, plus one and moving zero Topic 1: intersection of two arrays Given two arrays, write a function to calculate their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [4,9] explain: […]

[insist on one question per day 9.2] 219 Duplicate Element II present
Given an integer array and an integer k, judge whether there are two different indexes I and j in the array, so that num [i] = num [J], and the absolute value of the difference between I and j is at most K. Example 1: Input: num = [1,2,3,1], k = 3Output: trueExample 2: Input: […]

Algorithm interview question 5: reverse string, integer inversion, the first unique character in the string
Here is a personal solution to reverse string, integer inversion and the first unique character in string Topic 1: reverse string Write a function that inverts the input string. The input string is given in the form of character array char []. Do not allocate additional space to another array. You must modify the input […]

Experiment 2
1 # basic operation exercises: list and list derivation, formatting and type conversion 2 x = list(range(10)) 3 print (‘integer output 1:, end = ”) 4 for i in x: 5 print(i, end=’ ‘) 6 print (‘\ n integer output 2:’, end = ”) 7 for i in x: 8 print (f ‘{I: 02D}’, […]

[daily algorithm / brush through leetcode] 8 String to integer (ATOI) (medium)
Click here to view more content related to algorithmic interview~ Title Description You can convert it into an integer, ATOI function. First, the function discards useless opening space characters as needed until the first non space character is found. The next conversion rules are as follows: If the first non null character is a positive […]

C serial 21 printf with return value, print long string and scanf
1、 Printf() return value Printf() function has a return value, which usually returns the number of printed characters. If there is an output error, printf() returns a negative value (different versions will have different values) #include int D21_1_prntval(void) { int bph2o = 212; int rv; rv = printf(“%d F is water’s boiling point.\n”, bph2o); printf(“The […]

[learn Python Series 6 from Xiaobai] basic concepts of type / string / identifier / object / logical line and physical line / indentation
1. Four types There are four types of numbers in Python: integer, long integer, floatingpoint number and complex number. Integer, such as 1 Long integers are relatively large integers Floating point numbers such as 1.23 and 3e2 Plural, such as 1 + 2J, 1.1 + 2.2j 2. String String (sequence of characters) Single quotation marks […]

[yibentong 1676] mobile game solution
1676: Mobile Games Title Description There is such a game on Mingming’s mobile phone. There are $n $monsters in a row, and the blood volume of each monster is $M_ i$。 Now you can shoot $k $fireballs with damage of $p $. When a fireball hits the $I $monster, the $J $monster ($J ≤ I […]

Algorithm notes – depth first search
“Let your right hand always stick to the wall on your right” Recommended userecursionTo implement DFS, the system will call when recursion is usedSystem stackTherefore, the essence of implementing DFS with recursion is stillStack Vector common functions: function function Time complexity push_back(x) Add an element after the vector O(1) pop_back() Delete tail element of vector […]

How to master java basic data?
In computer language, data type is an abstract expression of memory location, which can be understood as an abstract expression of memory. When you come into contact with each language, you will have an understanding of data types. There are complex and simple data types. All data types need to be understood in the early […]