Ad
  • Default User Avatar

    However, i am missing the point on this testcase

    [20, 30, 40, 30, 20, 10]), 13

    13 would result from this
    [1 2 4 3 2 1]

    is tht right?
    if that is so, then 20 has no visibility, so it will get a 1
    30 can see 20, so it will be 1+1 = 2
    40 can see 30 on its left and 30 on its right
    However it seems that the 30 on its right takes precedence.... why? is there still something i am
    not seeing?
    Thanks again and regards
    Marco

  • Default User Avatar

    your explanation is v clear. by adjacent i inferred only the team before..not the team before and the one after.my bad.rhanks for following up

  • Default User Avatar

    HI guys
    sorry, for this testcase [30, 20, 10] why should the minimum bonus be 6?
    the first team does not know, so it gets 1k, the second team does not know, so it gets 1k
    and the third team does not know, so it should get 1k.
    Where does the 6 come from ? nobody in this sequence will know the amout of the adjacent?
    Kind regarsd
    marco

  • Default User Avatar

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

  • Default User Avatar

    sorry guys i dont undestand. I am given a query function,but i dont know N at all. where do i get N from?
    Kind regards
    Marco

  • Default User Avatar

    Hi all
    uhm i am seeking some hints here as my code runs out of time
    So i take it i'd need to use an efficient algo to find the prime factors, and once i have the prime factors i can then generate divisors out of prime factors,.
    Sort of two loops,where the first one is 'expensive' and the second one should be a 'small one'
    Giving my code is runnign out of time i am guessing my prime factorization code is deficient...
    is there a formula somewhere to find prime factors?
    Kind regars
    Marco

  • Default User Avatar

    Great! thanks! i think i figured it out on paper by just observing relationship between runs of the algo for 1..10 and it looks like another well known series .
    I cant believe this is pure coincidence.. would you mind sending me some useful links on this
    to my private email mmistroni@gmail.com ?
    Many thanks for putting me on the right track!
    moderator feel free to ban this comment if it gives the solution away
    kind regards

  • Default User Avatar

    Hi all
    am a little bit rusty on math and i need a starting point
    Have kicked off a brute force algo, can see that for
    n=4 we have 9 possible permutations, 3 starting with 2, 3 starting with 3 and 3 starting with 4
    n=5 we have 44 possibilties, 11 starting with 2, 11 starting with 3, 11 starting with 4, and 11 starting with 5
    so the number of permutations are always the same for 1 < i <=n, which seems to be
    permutation(n-1) - "something which i can figure out"

    Could anyone give me a trace without exposing to much?
    Kind regars
    Marco

  • Default User Avatar

    Many thanks, understood!
    kind regards

  • Default User Avatar

    Hello
    uhm for this testcase, gap(10, 300, 400)

    my code returns (307,317) which are both primes

    However, the sample states that the solution for such function should be (337,347)

    what am i missing?

    regards
    Marco

  • Default User Avatar

    Hello
    uhm wondering if someone could give me a trace to put me on the right track?
    I have explored gcd (failed) and phi - whose time complexity is sqrt(n) - , but i am always ending up in overtime..
    From comments i gather looping is not a good idea.. so i am guessing there are some formulas somewhere that, given a n, can find all coprimes?

    regards
    Marco

  • Default User Avatar

    Retired? how come?

  • Default User Avatar

    thanks, looks like i am failing to evaluate 1.1 + 2.2 + 3.3
    i am doing , in my evaluation , str(item).is_numeric which returns false for 1.1
    will need to revisit my logic

  • Default User Avatar

    Hello
    uhm i am puzzled. My solution pass all the tests but at the end i am gettign this exception

    Traceback (most recent call last):
    File "main.py", line 25, in
    actual = Calculator().evaluate(key)
    File "/home/codewarrior/solution.py", line 105, in evaluate
    return self.evaluate_expression(res)
    File "/home/codewarrior/solution.py", line 77, in evaluate_expression
    op2 = operandStack.pop()
    IndexError: pop from empty list

    and even though i am outputing inputs, i cannot figure out which test i have failed
    Could anyone assist?
    kind regards

  • Default User Avatar

    Hi all
    uhm i dont understand why the test sample is using these two functions

    dec2FactString(n)
    factString2Dec(n)

    i thought we only have to implement fact_string_2_dec / dec_2_fact_string ?

    My code cannot even go though basic tests..
    any hints>
    regards

  • Loading more items...