Solution: 01publicBoolean xyzThere(String str) { 02intlen = str.length(); 03String xyz ="xyz"; 04 05Boolean match =false; 06 07if(len <3) 08returnfalse; 09 10for(inti =0; i < len -2; i ++) { 11String temp = str.substring(i, i+3); 12if(temp.compareTo(xyz) ==0&& i...
Warmup-2 Medium warmup string/array loops (solutions available) String-1 Basic string problems -- no loops Array-1 Basic array problems -- no loops. Logic-1 Basic boolean logic puzzles -- if else && || ! Logic-2 Medium boolean logic puzzles -- if else && || ! String-2 Medium Stri...
Warmup-2 Medium warmup string/array loops (solutions available) String-1 Basic string problems -- no loops Array-1 Basic array problems -- no loops. Logic-1 Basic boolean logic puzzles -- if else && || ! Logic-2 Medium boolean logic puzzles -- if else && || ! String-2 Medium Stri...
Code Issues Pull requests java solutions codingbat warmup-1 warmup-2 string-1 array-1 logic-1 logic-2 string-2 string-3 array-2 array-3 ap-1 recursion-1 map-1 map-2 Updated Apr 2, 2017 Java BlesslinJerishR / Batzyon Star 10 Code Issues Pull requests Codingbat in the Pythonic...
Warmup-2 Medium warmup string/list problems with loops (solutions available) String-1 Basic python string problems -- no loops List-1 Basic python list problems -- no loops. Logic-1 Basic boolean logic puzzles -- if else and or not ...
publicString fizzString(String str) { booleanfizz = str.charAt(0) =='f'; booleanbuzz = str.charAt(str.length() -1) =='b'; if(fizz && buzz)return"FizzBuzz"; if(fizz)return"Fizz"; if(buzz)return"Buzz"; returnstr; } fizzString2: ...
string-2 Update function documentation for first_last6.py, count_evens.py, cig… Oct 1, 2024 warmup-1 Update function documentation for first_last6.py, count_evens.py, cig… Oct 1, 2024 warmup-2 Update function documentation for first_last6.py, count_evens.py, cig… ...
Java > Recursion-1 > bunnyEars2 (CodingBat Solution) bunnyEars2(0) → 0 bunnyEars2(1) → 2 bunnyEars2(2) → 5 Solution: 1publicintbunnyEars2(intbunnies) { 2; 3if(bunnies %2==0)return3+ bunnyEars2(bunnies-1); 4return2+ bunnyEars2(bunnies-1...
1 2 3 4 public int powerN(int base, int n) { if (n == 0) return 1; return base * powerN(base, n - 1); } countX: 1 2 3 4 5 public int countX(String str) { if (str.length() == 0) return 0; if (str.charAt(0) == 'x') return 1 + countX(str.substring(1))...