Ad
  • Custom User Avatar

    The use of Float80 for factorial calculations may help avoid integer overflow, but it introduces potential for rounding errors. The optimization to check only up to n/2 is clever due to the symmetry of binomial coefficients; however, this could miss solutions where x is greater than n/2. Consider an iterative approach to calculate combinations, which is typically more efficient and avoids the complexities of floating-point arithmetic. Additionally, ensure the function can handle cases where the solution is on the higher side of n/2.

  • Custom User Avatar

    I also like your solution, but when I test it with the following function call, empty arrays are returned - but not all of them...

    flattenTwoLevels([1, [], [2, 3],[4, 5, [6, 7, 8], 9, [], 10, [11, [12, [13, 14], 15], 16], 17], [], 18]) ->

    [1, [], [2, 3], [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [], 18]

  • Custom User Avatar

    Hi, I didn't make the Swift translation (which I assume is the one with the one with the Dot) you're commenting; yet, I checked the code, and found this in the preloaded code for the kata:

    enum Dot: Int {
    	case a = 0, b, c, d, e, f, g, h, i
    }
    

    Hope that helps with your doubt, but as I don't code in Swift, I wouldn't be sure if that's what you're looking for.

  • Custom User Avatar

    What's the Dot class? It's not included in the starting code, should be String or something

  • Custom User Avatar

    Should have explain better on this seriously, "come before" can be understand as stand before as place in the string, so "2000" start with "2" and "11" start with "1", if sort by string then become "11 2000"

  • Custom User Avatar

    I guess this kind of assessment is rather subjective: if you are good with regex, several katas using them would feel like they are 1-2 kyu too higher for you, but for most devs they are not such a piece of cake.

  • Custom User Avatar

    Got it :D It's just that I think many more 6 kyu kata is way harder for solving, maybe due to different in language

  • Custom User Avatar

    Judging from the sheer number of users who add troubles completing it and that 7 kyu should be really a beginner-ish kata, I might beg to differ.

  • Custom User Avatar

    This seems to be too easy for 6 kyu, should be 7 kyu?

  • Custom User Avatar

    Also cant find the answer for this crap, to initial is not correct since it will always product rounded number, but the result is a double, to the price getting updated every month then i get 355 after month 6, super confusing

  • Custom User Avatar

    like seriously, cant he just print the expected so that people can see where is the wrong part, sad life

  • Custom User Avatar

    Can someone print the expected in the Array should have same length?, Like this we cant even know what we did wrong

    What kind of test passed 207 cases but wrong on 1 eg.(100,100,100,100, I return [(0,20000)]) ??? I think testcases on Swift is wrong

  • Custom User Avatar

    The swift version of this have no test cases at all