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&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