Marks :10
: 2 | : 0
Given a string $$$A$$$ consisting of $$$n$$$ lowercase English alphabets. Consider a function that takes a character as an argument and returns the $$$ASCII$$$ value of the character. For example $$$f(a)=97,f(z)=122$$$.
For each index $$$i (1 \le i \le n)$$$, determine the count of indices $$$j$$$ such that $$$j > i$$$ and $$$|f(Ai)-f(Aj)| \leq D.$$$
Here $$$|x|$$$ denotes the absolute value of $$$x.$$$
Return an array of $$$n$$$ integers, each of which denotes for each index $$$i (1 \le i \le n)$$$, the count of indices $$$j$$$ such that $$$j > i$$$ and $$$|f(Ai)-f(Aj)| \leq D.$$$
The first line contains an integer $$$n$$$, denoting the length of the string. The second line contains the string $$$A$$$ consisting of $$$n$$$ lowercase English alphabets. The third line contains an integer $$$D$$$.$$$(1 \le n,D \le 10000)$$$
For each index $$$i (1 \le i \le n)$$$, determine the count of indices $$$j$$$ such that $$$j > i$$$ and $$$|f(Ai)-f(Aj)| \leq D.$$$
4 bbac 1
3 2 0 0
5 zscda 6
0 0 2 1 0
5 jsxhv 2
1 0 1 0 0
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.