Ad
  • Custom User Avatar

    In my opinion description is a bit unclear and written in a way that is misleading / difficult to understand

    Here's a simplified version of the task description:

    "You have a string made up of the letters 'D', 'P', and 'C'. Your task is to find the smallest positive number, N, that satisfies certain rules based on the string. Here are the rules:

    For each position in the string (let's call this position 'i'), do the following based on the character at that position:

    • If the character is 'D', the number N should be divisible by 'i'. In other words, when you divide N by 'i', there should be no remainder.
    • If the character is 'P', the number N should not share any common factors with 'i', except for 1. This means that N and 'i' don't have any divisors in common other than 1.
    • If the character is 'C', the number N should NOT be divisible by 'i' (meaning there is a remainder), and also N should share some common factor with 'i' other than 1.

    Find the smallest number N that satisfies all the rules for the given string. If no such number exists, return -1. The number N should be less than or equal to 1 billion (1,000,000,000)."

  • Custom User Avatar

    Wouldn't it be better to add in the description that the correct answer for middlePyramid is 1074 not 1064? As many people thinks it's an issue it would laso be good to add some hints like that it is based on "Greedy algorithm" or that you should use dynamic programming technic to solve it? I understand that it is good practive to look for an answer however in order to catch a fish you need a fishing rod first.

  • Custom User Avatar

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

  • Custom User Avatar

    Don't look at it

  • Custom User Avatar

    I already admitted to mistake. There is no need to continue this topic.

  • Custom User Avatar

    The worst code I have ever written... I am proud of it

  • Custom User Avatar

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

  • Custom User Avatar

    I have to say that you are right. The problem I have with these is that I can have a good idea and solution for first few tests but then it's not fast enough and I can't find a way to make it faster :/ (In this particular case I don't even use a loop)

  • Custom User Avatar

    Idk these "Math" katas are diffrent from other katas because you can have working code but you will not pass it only beacuse it's not fast enough. It's like having a car race you both have cars, you both making the same distance but if your opponent has a ferrari and all you have is opel astra you will still lose even tho you did nothing wrong. It's just annoying.

  • Custom User Avatar
  • Custom User Avatar

    Why in this example "2000 10003 1234000 44444444 9999 11 11 22 123"
    => 11 should be before 2000 but 22 shouldn't be before 10003?

    Result /"11 11 2000 10003 22 123 1234000 44444444 9999"/

  • Custom User Avatar

    Alright done it but I hate it when understanding the issue takes 5x times longer than the actual coding

  • Custom User Avatar

    Good luck solving this shit in c#. Your code may work fine but then you are submitting it and getting colossal numbers that can't be procceded. This kata is joke.

  • Default User Avatar
  • Default User Avatar

    It was good kata.
    For these that didn't complete yet, remember that string can be empty :>

  • Loading more items...