In Ruby, the random test doesn't make sense: the discounted price was listed as 403 and the sale percentage was 100. If the sale percentage is 100, then the discounted price should be 0 (and the original price could be anything).
Maybe we are all secret geniuses?
I think because he used .net framework where you need a special syntax to use replace with string delimiter. He probably didnt know it.
Why not just split on "WUB" to begin with? To skip the extra step.
C translation kumited
please scrutinize for approval
there are a constant number of vowels, so it is also O(1)
Can someone help me understand the double "First"?
Victor-Sun, if you just do Count() on something, you'll count everything. However, Count() also has an overload that takes a predicate, which is basically a filter telling Count() whether or not to include an item in the count. You can think of Count(predicate) as shorthand for Where(predicate).Count() if you'd like.
Thus, in the expression s => s, you're telling Count() to only count items if they are true.
s => s
I know this is old, but can someone explain where the s comes into play?
I know the left side s is the parameter but the right side s is what is returned, but how does that return if the vale is true if there is only the parameter.
string.Concat() would be better than string.Join(), since you're not using the separator.
Haskell : https://www.codewars.com/kumite/5b7dfde7bd29b2e7a80000df?sel=5b7dfde7bd29b2e7a80000df
Your function is returning 547.0 there, the expected value is ok.
Test in Ruby are wrong.
There are not rounded correctly.
In the Kata instruction, it is asked to round with 2 digits but in the random exemple it is rounded strangly for exemple this test fails:
Testing for 186 and 66
It should work for random inputs too - Expected: 547.06, instead got: 547.0
If I do the math manually I obtain: 547.058823... rounded it is 547.06.