7 kyu

Jumps in a cycle #1

228 of 323Donvito-911
Description
Loading description...
Mathematics
Puzzles
Performance
  • Please sign in or sign up to leave a comment.
  • amallya88 Avatar

    solved it after googling for some help. warning to all - this kata is basically a "trick" question. the answer isn't particularly interesting, and you won't learn anything, really. this is niche, pure computer science problem rooted in mathematics.

  • amallya88 Avatar

    it is not necesary to iterate over the input array in any way. i literally del cycle_list and run my code. (python). even imported gc and did a garbage collect after deleting the input list.

    i have my code passing fixed, random and both efficiency tests (2^20 and 2^30). so clearly the algo i've hit upon is valid.

    however i get STDERR Execution Timed Out (12000 ms)

    overall, a pretty crap exercise for a 7 kyu rating. this is a platform limitation.

  • MikChan Avatar

    This comment has been hidden.

  • blzzua Avatar

    Some dissatisfied with the task, because in the tests there is a performance test for 7 kyu kata, with a very large number of items. Unlike the actual implementation of the algorithm, which is described in detail, you need to do the math. It takes away the ability to implement The algorithm.

  • nomennescio Avatar

    Reading the discussion below, I think the description should use "index" instead of "element", because the whole "indistinguishable" only makes sense when you completely ignore the actual elements in the array.

  • eurydice5717 Avatar

    This comment has been hidden.

  • Discordanian Avatar

    This comment has been hidden.

  • Kacarott Avatar
  • Kacarott Avatar

    ASSUMPTION: The elements in the cycle are distinguishable.

    Don't you mean indistinguishable? Elements being distinguishable would mean they are all unique, but you explicitely test arrays with duplicate elements (even labelled as "Distinguishable cycle"). I think you are getting words mixed up?

  • monadius Avatar

    Rust:

    1. The initial solution function should be

      fn get_jumps(cycle: Vec<i32>, k: i32) -> i32 {
       todo!()
      }
      
    2. All test code should be defined inside the module tests (right now it is possible to call the gcd function defined in tests and it is not possible to redefine it).

  • B1ts Avatar

    Some random tests pass numpy arrays, which isn't mentioned anywhere. Regular lists should be passed instead.

  • Heathro Avatar

    This comment has been hidden.

  • 66  Avatar

    Please review: C++ Translation