Fold2 1207. Vowel Count Return the number (count) of vowels in the given string. We will consider a, e, i, o, u as vowels for this Kata (but not y). The input string will only consist of lower case letters and/or spaces. Solution: int getCount(String inputStr){ List arr = []; for (String s in inputStr.toLowerCase().split('')) { if (["a","e","i","o","u"].contains(s)) { arr.add(s); } } return arr.length; } import "dart:c.. 2022. 12. 7. 1206. Sum of positive ou get an array of numbers, return the sum of all of the positives ones. Example [1,-4,7,12] => 1 + 7 + 12 = 20 Note: if there is nothing to sum, the sum is default to 0. Solution: int positiveSum(List arr) { int result = 0; for (int a in arr) { if (a > 0) { result += a; } } return result; } int positiveSum(List arr) { return arr.where((l) => l > 0).fold(0, (p, c) => p + c); } import "dart:math".. 2022. 12. 6. 이전 1 다음