First, the title description of the people are not familiar with the palindrome? A string from the previous look and look at the following assumptions. is a palindrome string. For example, "Shanghai tap water from the sea" is a palindrome string.
Now our problem is coming. Consider 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);
Thinking 1, converting a long to a string. From the beginning and the end of the middle scan can be 2, each take out the head and tail of the number, compare, and then to turn tail 3, remove each bit into the stack, and then pop up a new number. Compare with original number
Second,The product of two polynomials in the description of the topic
Pa=an*x^n + an-1*x^ (n-1) + ... + a1*x + a0;
Pb=bm*x^n + bm-1*x^ (n-1) + ... + b1*x + b0;
Among them, 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 a program that multiplies two polynomial.
C++:
String multiplyploynomial (const string&pa,const STRING&PB);
Java:
String Multiplyploynomial (String pa,string PB);
Both PA and PB formats are "( -3,5), (87,4), (93,3), (3,0)". Represents a polynomial of -3*x^5 + 87*x^4 + 93*x^3 + 3.
The input is all legal. In addition to numbers, the left and right brackets and commas have no other characters whatsoever. And the power is all from high to low, the output is also required to be this standard format.
Thinking of solving problems
The list is used to represent the polynomial, because it is assumed that the array may encounter sparse problems. At the same time, the linked list can dynamically join nodes.
By multiplying, the 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 graph. Lazy ~ ~ ~ Not how the figure will
2015 Millet pen questions seen on several forums