id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

pais@kinetigram.com recursion02 > R23_countPairs
prev  |  next  |  chance

APCS Recursion 2, Problem 3. 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.


R23_countPairs("axa") → 1
R23_countPairs("axax") → 2
R23_countPairs("axbx") → 1

...Save, Compile, Run (ctrl-enter)

public int R23_countPairs(String str) }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 300

Copyright Nick Parlante 2017 - privacy