← 返回 amazon 的题目列表1. Pascal Tangent Encryption for Odd-Positioned Digits 2. Counting Matching D-Length Substrings Between Strings
类型:online_judge
amazon
Question 1
In Amazon's security measures, developers use an encryption method called "Pascal Tangent". Given a list of numbers consisting of 4, 5, and 7, when an odd-positioned digit is encrypted, the digit is replaced by the sum of its neighboring digits modulo 10. Report the final encrypted string.
Example:
Input: [4, 5, 6, 7]
Output: 04
Question 2
Amazon has a large customer database. To prevent cross-promotion to employees of different companies, they have decided to employ a D-substring scoring system to determine string matches.
Given two strings s1 and s2 with lengths n and m, for each substring of length D in s1, find if there is a matching substring in s2 and return the total number of matching substrings.
Constraints:
1 \\leq |s1|, |s2| \\leq 100
1 \\leq D \\leq min(|s1|, |s2|)
Example:
Input: s1 = "abcaaaaab", s2 = "baaaccab", D = 3
Output: 2
Example
Input
4 5 6 7