Beta

Possible Triangles Formed with Available Iron Rods

5 of 7raulbc777
Description
Loading description...
Fundamentals
Data Structures
Algorithms
Mathematics
Geometry
Logic
Strings
  • Please sign in or sign up to leave a comment.
  • lechevalier Avatar

    Still time to fix this kata? :-D

  • Voile Avatar

    Time to fix this kata ;-)

  • kazk Avatar

    Thanks for this kata :)

    In some random tests for JavaScript, expected output contains duplicate (and shuffled?) entries.

    I haven't found exact condition to reproduce, but here's one example:

    Available rods = 6,16,17,27,29,33,42,61,65,72,85,99,105,118,126,135,144,151,156,167,183,199,206,208,213,218,234,259,260,263,274,282,289,300
    Maximum Length = 283 in
    Estimated Area = 3.0561 sqft
    Maximum Relative Difference = 35 %
    
    // Expected:
    [[17, 85, 99], [27, 61, 85], [29, 72, 99], [17, 61, 72], [17, 72, 85], [17, 61, 72], [17, 72, 85], [29, 42, 65], [17, 151, 167], [17, 135, 151], [42, 85, 126], [27, 118, 144], [27, 42, 61], [16, 61, 65], [16, 65, 72], [27, 29, 42], [16, 61, 72], [17, 167, 183], [33, 42, 72], [27, 42, 65], [17, 61, 65], [16, 72, 85], [16, 105, 118], [6, 213, 218], [16, 85, 99], [17, 65, 72], [42, 65, 105], [6, 208, 213], [29, 42, 61], [17, 183, 199], [29, 61, 85], [6, 259, 263], [6, 206, 208], [29, 99, 126]]
    // Expected.length == 34; [17, 61, 72] at index 3 and 5; [17, 72, 85] at index 4 and 6
    
    // Actual:
    [[17, 85, 99], [27, 61, 85], [29, 72, 99], [17, 72, 85], [17, 61, 72], [29, 42, 65], [17, 151, 167], [17, 135, 151], [42, 85, 126], [27, 118, 144], [27, 42, 61], [16, 61, 65], [16, 65, 72], [27, 29, 42], [16, 61, 72], [17, 167, 183], [33, 42, 72], [27, 42, 65], [17, 61, 65], [16, 72, 85], [16, 105, 118], [6, 213, 218], [16, 85, 99], [17, 65, 72], [42, 65, 105], [6, 208, 213], [29, 42, 61], [17, 183, 199], [29, 61, 85], [6, 259, 263], [6, 206, 208], [29, 99, 126]]
    // Actual.length == 32
    

    My solution passed 147 tests and failed 5 (haven't checked all 5, but first few had issue described above).

    I've also tried Python and same thing seem to happen.

    edit: format edit: reworded

  • raulbc777 Avatar

    I'll give 5 extra points to the first user in solving this one. :)

  • smile67 Avatar

    Hi Raul, congrats to your top 10 - hard worker;-)! Maybe you need holidays... some weeks or month:-)...?!

    • raulbc777 Avatar

      Thanks Mathias for your kind message. These are my hollydays comparing other stressing tasks that I've been doing for years. It seems that I've got to come back to them next year, so let's see how far I can go :)