Ad
  • Custom User Avatar

    Looking back, I can't say why the code was accepted at the time. I tried this code today, now the code is too slow. maybe the tests were changed.

  • Custom User Avatar

    generate_series looks like a table name but it is not the name of a table.

    generate_series is a PostgreSQL function. See the free PostgreSQL manual section 9.25. Set Returning Functions

    In this case the call generate_series(1,$1) returns a table with one column and the rows 1, 2, 3 ... up to the value $1.

    The column as named i with AS i. The field i is used inside the SELECT section to create the values as defined in the kata.

  • Custom User Avatar

    I had the same message. The cause was a NULL value in one row. A string is required in each row. (In the output, you can't see the difference between an empty string and a NULL value.)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I try to determine the difficulty level based on the description I can read under the kyu setting after selecting the kyu.

    From my perspective, a 4 kyu kata with "... Computer science concepts using complex algorithms ..." is difficult to build with SQL. The internal implementation of the database is far above the levels of a kata. But, to me, within the "pure" data query language SQL a programming of "complex algorithms" is quite impossible, because SQL was designed to hide the complexity of the data search process from the user. Maybe a kata needed the usage of the PL/pgSQL language can reach level 4 kyu or above.

    For me, a kata that can be solved in a dozen lines of SQL is in the range up to 5 kyu. Because the data manipulation/query langauge SQL is not designed as a tool to allow the implementation of complex algorithms.

    For me, this kata is in the 7 kyu range because the description "... Iterating arrays and returning a subset of values ... " fits well to the content of the kata. The level 6 kyu could be also an option "... Complex language features (closures, scopes, monads, etc) ..." which could correspond to SQL array functions.

    Thank you very much for the interesting katas. They help me very well to learn more about SQL. Your work creating new katas support me very well in my learning process.

  • Custom User Avatar

    There is a typo in the description:

    We have a tabke named ...

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Thank you. Now it works as expected.

  • Custom User Avatar

    I am not sure what to write in the product_summary text.
    Product 1: N times || Product 2: N times should the same number N be used for both products?

    In the example and in the test reference data, the two numbers N in all rows are always the same.

    Based on the description, I expected the first N to be the number of orders for product 1 and the second N to be the number of orders for product 2.

  • Custom User Avatar

    Thank you. A very good explanation. Now I understand the cause of my error.

  • Custom User Avatar

    My code fails in the "Advanced tests" section. I can't find the values which are correct.

    5 years ago the discussion with user challisa shows similar issues. But the values discussed there are the values my function returns.

    I added a print function at the end of my function:

      cat("return type",class(result),"return value",rep(result),"\n")
      return(result)
    

    The output of the Advanced tests are:

    Log
    return type numeric return value 0.009084805 
    
    Test Failed
    	`a` not equal to 0.009084805.
    	1/1 mismatches
    	[1] 1 - 0.00908 == 0.991
    

    and

    Log
    return type character return value sa 
    Test Failed
    	`b` not equal to "sa".
    	Types not compatible: double is not character
    

    In both cases the printed value inside my function and the printed expected result does match but the test fails.

    Can someone give me a hint? What are the correct return values to pass this two test cases?

  • Custom User Avatar

    Converting all integers to strings and converting them back to integers does not seem to me to be the best practice for this kata.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Clippy from the Rust tool chain has a hint for optimising the code:

    2 |     dna.replace("T", "U")
      |                 ^^^ help: try using a `char` instead: "T"
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
      = note: `#[warn(clippy::single_char_pattern)]` on by default
    
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...