Odd Substrings Medium

+100 PTS

Before you start the test, check out our tutorial challenge

  • TYPE CODE PRACTICE CHALLENGE
  • LANGUAGES C++, C#, JAVA, JAVASCRIPT AND 6 MORE
    LANGUAGES C++, C#, JAVA, JAVASCRIPT, PHP, PYTHON2, PYTHON, RUBY, SWIFT, TYPESCRIPT
  • TIME ~60MIN

Odd Substrings

Challenge outline

Hello and welcome to the challenge!


Write a code which receives a string with digits and counts all odd numbers included in its substrings.

Example

  • solve('3583') = 7, because we have 7 odd substrings: 3, 5, 3, 35, 83, 583 and 3583

Input

  • string consisting of digits

Output

  • amount of odd substrings of the given string

Constraints

  • 0 < length of the given string < 1000



You can solve this programming contest in Java, JavaScript, Python, C++ and many more languages. If you want, you can also take part in other May 2019 competitions. Below you can find some of them:



Did you like this challenge and would like to try your hand at some interesting big programming competitions? Check what’s all over the news in tech world in May 2019 in our article with upcoming IT Conferences, Hackathons and Online Challenges in May 2019.


Have fun and good luck! :)