We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9a9a79 commit abd0780Copy full SHA for abd0780
String-Fewer Notes
@@ -0,0 +1,26 @@
1
+
2
+problem statement
3
4
+https://www.codingninjas.com/codestudio/contests/codestudio-weekend-contest-53/7079253/problems/23064?leftPanelTab=0
5
6
7
8
9
10
11
+public class Solution {
12
+ static int aString(int x, int y, String s) {
13
+ char ch[] = s.toCharArray();
14
+ int count = 0 ;
15
+ if(ch[0] == 'b')count =1 ;
16
17
+ for(int i =1; i<s.length() ;i++){
18
+ if(ch[i] == 'b' && ch[i-1] == 'a'){
19
+ count++;
20
+ }
21
22
23
+ if(count == 0)return 0;
24
+ return y + (count -1) * Math.min(x , y);
25
26
+}
0 commit comments