Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6560 |

@blackshadows | 6400 |

@mb1973 | 5777 |

@Quandray | 5271 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 5074 |

@kirtidee18 | 4356 |

@sanjay05 | 3762 |

@mantu_singh | 3638 |

@gfgaccount | 3601 |

@marius_valentin_dragoi | 3525 |

Complete Leaderboard | |

Handle | Score |

@anish5256 | 991 |

@vimleshpratapsingh321 | 980 |

@skj7 | 871 |

@akhileshkumar562002 | 862 |

@pradeeppatidar1999 | 840 |

@kanewilliamson123 | 837 |

@pd420786 | 813 |

@infilooop | 800 |

@bunnybug320 | 796 |

@smitabose7826 | 784 |

@virgat | 768 |

Complete Leaderboard |

Given a string **S** of **lowercase english **characters, find out whether the summation of **X** and **Y** is** even **or

Note: Positive means greater than zero.

**Example 1:**

**Input: S** = "abbbcc"
**Output:** "ODD"
**Explanation: **X = 0 and Y = 1 so (X + Y) is
ODD. 'a' occupies 1st place(odd) in english
alphabets and its frequency is odd(1), 'b'
occupies 2nd place(even) but its frequency
is odd(3) so it doesn't get counted and 'c'
occupies 3rd place(odd) but its frequency
is even(2) so it also doesn't get counted.

**Example 2:**

**Input: S** = "nobitaa"
**Output:** "EVEN"
**Explanation:** X = 0 and Y = 2 so (X + Y) is
EVEN.

**Your Task: **

You dont need to read input or print anything. Complete the function **evenOdd() **which takes S as input parameter and returns "EVEN" if X + Y is even, "ODD" otherwise.

**Expected Time Complexity: **O(|S|)

**Expected Auxiliary Space: **O(1)

**Constraints:**

1 ≤ |S| ≤ 1000

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Odd Even Problem

...