Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given a string s of lowercase English characters, find out whether the summation of x and y is even or odd, where x is the
Given a string of lowercase English characters, find out whether the summation of and is even or odd, where is the count of distinct characters that occupy even positions in English alphabets and have even frequency, is the count of distinct characters which occupy odd positions in English alphabets and have odd frequency. Note: Positive means greater than zero. Example : Input: abbbcc Output: ODD Explanation: and so is ODD. a occupies st placeodd in english alphabets and its frequency is oddb occupies nd placeeven but its frequency is odd so it doesn't get counted and c occupies rd placeodd but its frequency is even so it also doesn't get counted. Example : Input: nobitaa Output: EVEN Explanation: and so is EVEN. Your Task: You don't need to read input or print anything. Complete the function evenodd which takes s as input parameter and returns "EVEN" if is even, and returns "ODD" otherwise. Expected Time Complexity: Expected Auxiliary Space: Constraints:
Given a string of lowercase English characters, find out whether the summation of and is even or odd, where is the count of distinct characters that occupy even positions in English alphabets and have even frequency, is the count of distinct characters which occupy odd positions in English alphabets and have odd frequency.
Note: Positive means greater than zero.
Example :
Input:
abbbcc
Output:
ODD
Explanation:
and so is ODD. a occupies st placeodd in english alphabets and its frequency is oddb occupies nd placeeven but its frequency is odd so it doesn't get counted and c occupies rd placeodd but its frequency is even so it also doesn't get counted.
Example :
Input:
nobitaa
Output:
EVEN
Explanation:
and so is EVEN.
Your Task:
You don't need to read input or print anything. Complete the function evenodd which takes s as input parameter and returns "EVEN" if is even, and returns "ODD" otherwise.
Expected Time Complexity:
Expected Auxiliary Space:
Constraints:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started