The thinking mode of the algorithm

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.