First one ad:
Professional Wholesale Poly-VARIANT energy block manufacturing machine, star-level photon energy block manufacturing machine, positive-particle ship engine, air energy conversion battleship engine, two-dimensional space generator, three-dimensional space stabilizer, stellar quantum super light brain, natural planetary environment manufacturing machine, star limit environment simulator, planetary cutting resource collector, stellar Star catcher, High energy compressor, meson space fixed instrument, four-dimensional space jumping device, star Gate, sub-space limit speed stabilizer, star jumping device ... All buy the Ultimate secret of the Universe: excavator technology which strong
1. Counting
The chess board consists of a horizontal longitudinal 19*19 line, and How many squares are the lines composed of?
Solution 1: A number of one, side length of 1, edge length of 2, ...., side length is 18, so there are 1^2 + 2^2 + ... + 18^18.
Solution 2: Count the number of squares with a certain point as the lower right corner, this is too troublesome ...
2. Logical reasoning
The emperor was not poor, and among the miser there were poor, so some _______ were not _______.
Solution:
② some Scrooge was poor
① the poor are not emperors ==> some Scrooge is not the emperor.
3. Maximum contiguous Subarray
Given an array a[0,..., n-1], a continuous subarray of a, making the subarray and maximum.
? For example
? Arrays: 1,-2, 3, 10,-4, 7, 2,-5,
? Maximum sub-arrays: 3, 10,-4, 7, 2
The thinking mode of the algorithm