May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.
Recursion-1 > countPairs
prev | next | chance
We'll say that a "pair" in a string is two instances of a char separated by a char. So "AxA" the A's make a pair. Pair's can overlap, so "AxAxA" contains 3 pairs -- 2 for A and 1 for x. Recursively compute the number of pairs in the given string.
countPairs("axa") → 1
countPairs("axax") → 2
countPairs("axbx") → 1
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Java - accessing a parent class member when another class inherits from the parent class||9||57|
|How to properly export data from two SAS datasets to one XML data file?||5||47|
|msiexec won't run||4||33|
|How do I buy BitCoin?||4||30|
Join the community of 500,000 technology professionals and ask your questions.