You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose you have a string, S, made up of only 'a's and 'b's. Write a recursive function that checks if the string was generated using the following rules:
3
+
a. The string begins with an 'a'
4
+
b. Each 'a' is followed by nothing or an 'a' or "bb"
5
+
c. Each "bb" is followed by nothing or an 'a'
6
+
If all the rules are followed by the given string, return true otherwise return false.
0 commit comments