Changes between Version 16 and Version 17 of ProgrammingPrompts
- Timestamp:
- Nov 25, 2015, 1:43:10 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ProgrammingPrompts
v16 v17 31 31 For this problem, you will implement a simple hash/checksum algorithm. 32 32 33 Write a static method that takes in a string and returns it's {{{ short}}}typed checksum. Calculate the checksum using the following steps:33 Write a static method that takes in a string and returns it's {{{long}}}-typed checksum. Calculate the checksum using the following steps: 34 34 1. For each character, convert the {{{String}}} to a {{{char}}}. 35 35 2. For each {{{char}}}, raise it to the power of its index. (For example, the 7th {{{char}}} will be raised to the 6th power.) 36 36 3. Sum the powers. 37 4. Modulus divide the sum to make it fit in a {{{short}}} data type.37 4. Allow overflow. 38 38 39 39 === !MovingAverage