5 kyu

Count The Hits Adding Contiguous Powers!

Description
Loading description...
Fundamentals
Mathematics
Permutations
Sorting
Logic
Strings
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar
  • Voile Avatar

    Is there any reason pow_ is limited to 2, 3 and 4? This seems like a very important information.

    • dfhwze Avatar

      To me it does not look to be important info, unless you want to micro-optimise your solution. I do think the max amount of numbers of digs in the input, and max power should be stated in the description.

  • Blind4Basics Avatar

    Hi Raul,

    • why the double output, while the first is always the length of the second?
    • the description is not the cleareast you did for now. ;) you're talking straight out about pow_ at the beginning of the description but you don't say that it's one of the inputs, for example.
    • [9, 16] 25 True <--- hit (we don't count it, we had a hit at 25) -> weird... we don't count it and we add a hit anyway? seems to me there is a contradiction here.

    cheers

  • kharrek Avatar

    Hey! I am working on this kata as we speak and I think I may have ran into an error. The permutational list for the first example is [3, 5, 2] (dig_list)----> [2, 3, 5, 23, 25, 32, 35, 52, 53, 235, 253, 325, 352, 523, 532]

    You asked for a combination of perfect powers of two that would be in this list but you only mentioned 5 and 25. I found that 324 + 1 is another combination. seeing as in

    powL = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529]

    there is indeed a sub array of 324 and 1

    Thanks!

    • raulbc777 Avatar

      It's says to form sub-arrays of contiguous terms. 324 has 289 before and 361 after. 1 and 324 are not contiguous. Thanks for the feedback, and I'll be waiting your answer if you've got any doubt.

    • raulbc777 Avatar

      I'm interested in having a word from you when you solve it.

    • kharrek Avatar

      I've solved it, haven't solved the additional problems on submit however. Well, not in the speed it requires :( I'll have to get back to this

    • raulbc777 Avatar

      Perhaps operations with sets may fasten your code.