| about | help | code help+videos | done | prefs |
nSwapAB
Given a String 's' and a non-negative integer 'n' change the first n occurrences of "a" to "b" or "b" to "a". For example: "aaron braskin" and "2" yields: "bbron braskin" because the first two occurrences and 'a' or 'b' have been swapped but the third occurrence has been left alone. nSwapAB("aaron braskin", 0) → "aaron braskin" nSwapAB("aaron braskin", 1) → "baron braskin" nSwapAB("aaron braskin", 2) → "bbron braskin" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200
Copyright Nick Parlante 2017 - privacy