2015 Millet pen questions seen on several forums

Source: Internet
Author: User

First, the topic describes everyone to the palindrome is not unfamiliar it? A string from the front and back look if the same, is a palindrome string, such as "Shanghai Water from the Sea" is a palindrome string. Now our problem comes, to think of a number as a string and ask if it is a palindrome number? The higher the score, the lower the time complexity and the less space complexity.
C++:
BOOL Ispalindromenumber (long num);
Java:
Boolean ispalindromenumber (long num);



Problem solving ideas 1, the long conversion to a string, from the beginning and the end of the middle scan can be 2, each take out the number of head and tail, compare, and then go to the end 3, remove each bit into the stack, and then pop up a new number, and the original number comparison
Second,The product of two polynomials in the title description
Pa=an*x^n + an-1*x^ (n-1) + ... + a1*x + a0;
Pb=bm*x^n + bm-1*x^ (n-1) + ... + b1*x + b0;
Where an,an-1...a1,a0,bm,bm-1...b1,b0 are integers, the range is [ -1000,1000],0<=n,m<=1000. The result of PA*PB is also polynomial, please design how to represent a polynomial, and write out two polynomial multiplication program.
C++:
String multiplyploynomial (const string&pa,const STRING&AMP;PB);
Java:
String Multiplyploynomial (String pa,string PB);
The PA and PB formats are both "( -3,5), (87,4), (93,3), (3,0)", which represents a polynomial of -3*x^5 + 87*x^4 + 93*x^3 + 3. Input is legal, except for numbers, the left and right brackets and commas have no other characters, and the power is arranged from high to low, and the output also requires the standard format.

Thinking of solving problems
A linked list is used to represent a polynomial, because if the array is likely to encounter sparse problems, the linked list can dynamically add nodes.
When multiplying, HashMap is used to hold the result of multiplying by 22, and finally the polynomial can be constructed by scanning the HashMap again.
Third,


This question should be about the figure, lazy ~ ~ ~ Not how the figure will

2015 Millet pen questions seen on several forums

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.