Ad
  • Custom User Avatar

    Looks too simple for 4kyu at least from C++ point of view.

  • Custom User Avatar

    The test design creates an implicit requirement that isn't stated in the problem description - solutions must cache results between test executions to pass within time constraints. This favors O(n²) algorithms with caching over potentially more efficient algorithms without caching. ( there is no really efficient algorithms among the solutions. )

    The code length limit seems to disfavor code commenting, what seems to be bad idea from learning perspective. Comments should not be counted.
    Meaningful variable names are discouraged by the code length limit.

  • Custom User Avatar

    You are correct that a pure absolute tolerance (like 1e-12) can be problematic when dealing with values across many orders of magnitude. However, for the purpose of this specific problem, we are to treat the given tolerance as a defined part of the problem's constraints. We will implement a solution that works within this framework, acknowledging that in a broader, real-world context, a relative or mixed tolerance might be more robust.

    Regarding your second point about the discontinuous function: you've identified a crucial distinction. The problem is not asking us to compute the limit to enforce continuity; it is asking us to evaluate the function at the point. The function f(x) = 1 for x ≠ 0 and f(0) = 0 is perfectly well-defined at x=0—its value is simply 0. The fact that this value is discontinuous with the limit is a property of the function itself, not an error in evaluation. Our task is to return the function's actual value at the point, not to "fix" discontinuities by returning the limit.

    As the problem states, our role is to handle cases where a function is not properly defined at a point (like a division by zero that results in NaN or Inf) and, if possible, find a meaningful finite value (like taking a limit) to assign to it. In your example, the function is already well-defined at the troublesome point, so no such intervention is needed.

    You had stated there is an issue here, but it is not clear how one can be resolved. Seems the issue is that your expectation of the problem are not consistent with the problem itself. I suggest to remove the issue, but propose enhancement if we can.

  • Custom User Avatar

    It is not correct to use the absolute error with the tolerance 1e-12 when results could vary from very small (0) to very large (1e+200) values. In general, the problem is not well-defined because it is impossible to compute limits numerically without any additional knowledge about the tested functions.

    For example, the reference solution assumes that if r = f(x) is finite then r should be returned. It does not hold in general. Consider the function f(x) = 1 for x != 0 and f(0) = 0. The correct value which makes this function continuous at x = 0 is r = 1, not r = 0.

  • Custom User Avatar

    Personally i like this kata.

    1. After many years i learned that double can hold infinity and nan values and those could be processed accordingly.
    2. This kata uses std::function what is also quite interesting and useful technique
    3. This kata is having quite solid mathematical background and provide users with oportunity to enhance their math skills.

    What is the problem of this kata - the problem is in junction of math and computer science. It is really hard to define, understand and translate from the math the criteria for success.

    I think this Kata is a great oportunity for young students to touch convergence, but at the same time it can be solved by anyone.

  • Custom User Avatar

    Dear Summer, your point is fair, but seems absolutely not useful for this type of problems.

    If someone would analyze the tests behind the shadow and create solution which would be triggered sequentally such author would create more advanced code rather then problem requires, so what would be the value to perform random tests?

    I suggest to close the issue.

  • Custom User Avatar

    It is clamsy to say somthing is solved if nothing was.
    The task is to make function which would deal with numbers like 36!-1 and symbols [A-Z0-9]

    In reality required function which would deal with numbers like 21!-1 and symbols [A-J0-9]

    Wether it is obvious from the long long type of the return ? Absolutely no.

    Was this issue dealt with - no.

    Why the issue was resolved then?

  • Custom User Avatar

    it's tautological to say that the unsigned long long input will never be larger than ULLONG_MAX. other languages with fixed-width integers have the same limitations.

  • Custom User Avatar

    Dear Sir's Would be nice to add a small hint that strings shall be sorted based on ACII character values.

    ie using StringComparer.Ordinal comparator. Seems default for C# comparator using different logic.

  • Custom User Avatar

    Dear Smileous,

    The logic of your algorithm is quite right, it would generally work absolutely the same way as kanonical BWT, the difference is in the fact that canonical BWT should be expected to work not with letters of text, but with bytes and their values where character 'a' and 'A' are quite different letters having different ACII code values, while your algorithm implement some default C# comparison method with specific comparison logic.

    In order for you to fix your code you shall try to adjust default for C# sort order and to ensure that texts are sorted based on ACII codes of relevant characters.

    I assume that remark regarding sort order would be useful in KATA Description, but it is absolutely not mandatory, and would be not fare to consider it to be KATA issue.

  • Custom User Avatar

    I would write here reply on your old question, just to make a note on my understanding of join statement work.

    Databases are usually working with various data having certain characteristics based on which data could be filtered or sorted.
    If you have two independent sets of data you have to allign certain elements from one set with certain elements from another set.

    I.e. you do something like: for each element from set 1 find elements in set 2.

    In your particular case your request is: For each element in table posts find 2 elements in table categories where id's are equal.

    we took first post, take it category and search for it in table categories, obviouisly your limit statement does not make any sence as soon as for each element form posts table always exists only one record in categories ...

  • Custom User Avatar

    I wander if my solution would work at (3,-2) and if no, that would mean test envioronment does not have sufficient coverage.

  • Custom User Avatar

    Would be nice for a long test to provide some estimation of %% completion.
    '''if(i%(BIG_SIZE/10)==0) printf("%2.0f of the Addition test passed\n",(double)i/BIG_SIZE);'''

    That would give some clue if the solution is on the right track and need only cosmetical enhancments.

  • Custom User Avatar

    The logic behind the calculations of poker haands is straight forward.

    1. The player with rarest defined combination wins. (Straight flush, 4k, 3k+1p, Flush, Straight, 3k,2p,1p,nothing) where *k - is of a kind *p - is pair.
    2. If combinations are equal player with biggest combination cards wins
    3. The reminder is sorted and player with the first card bigger than opponent's wins
    4. The value of ace can be different.

    The whole difficulty of the kata is absence of clear defenition of the requirements...

    What i would suggest is to rephrase text above in better english and add it to description instead or together with wikipedia refference.

  • Custom User Avatar

    In fact you dont need, but the problem states:

    QT

    With these 36 digits we can now encode numbers up to 36!-1

    UNQT

    So in description should be clarified:

    With these 36 digits it is theoretically possible to encode numbers up to 36!-1, but for the purposes of this kata in C version numbers would be always less then ULLONG_MAX

    OR

    So we extend 0..9 with letters A..J. With these 20 digits we can now...

  • Loading more items...