Ad
  • Default User Avatar

    Tests do not necessarily test for "-1" being the coefficient of the term with the highest power of the variable (e.g. the x^3 coefficient of (-x+1)^3 is -1). In this case, my original code would have returned -1x^3 + ..., yet it passed because this case was not tested (I ran it again because I removed some print() statements, and then it failed).
    Brilliant kata, though—thanks!

  • Custom User Avatar

    Rust sample tests expect the function to be named expand_binomial, but the initial code and the full set of tests expect expand.

  • Default User Avatar

    Since Python 3.9, typing aliases like Tuple, List, or Set are deprecated because the type themselves (tuple, list, set ...) now directly support the [] operator. The type hints in the initial code should be rewritten in consequence

  • Custom User Avatar

    (Python) Apparently the test for specification "If the coefficient of a term is zero, the term should not be included" is not being performed. My first solution did not handle these cases and I passed every test.

    Ouput for expand("(r+0)^203") given by my first solution:

    r^203+0r^202+0r^201+0r^200+0r^199+0r^198+0r^197+0r^196+0r^195+0r^194+0r^193+0r^192+0r^191+0r^190+0r^189+0r^188+0r^187+0r^186+0r^185+0r^184+0r^183+0r^182+0r^181+0r^180+0r^179+0r^178+0r^177+0r^176+0r^175+0r^174+0r^173+0r^172+0r^171+0r^170+0r^169+0r^168+0r^167+0r^166+0r^165+0r^164+0r^163+0r^162+0r^161+0r^160+0r^159+0r^158+0r^157+0r^156+0r^155+0r^154+0r^153+0r^152+0r^151+0r^150+0r^149+0r^148+0r^147+0r^146+0r^145+0r^144+0r^143+0r^142+0r^141+0r^140+0r^139+0r^138+0r^137+0r^136+0r^135+0r^134+0r^133+0r^132+0r^131+0r^130+0r^129+0r^128+0r^127+0r^126+0r^125+0r^124+0r^123+0r^122+0r^121+0r^120+0r^119+0r^118+0r^117+0r^116+0r^115+0r^114+0r^113+0r^112+0r^111+0r^110+0r^109+0r^108+0r^107+0r^106+0r^105+0r^104+0r^103+0r^102+0r^101+0r^100+0r^99+0r^98+0r^97+0r^96+0r^95+0r^94+0r^93+0r^92+0r^91+0r^90+0r^89+0r^88+0r^87+0r^86+0r^85+0r^84+0r^83+0r^82+0r^81+0r^80+0r^79+0r^78+0r^77+0r^76+0r^75+0r^74+0r^73+0r^72+0r^71+0r^70+0r^69+0r^68+0r^67+0r^66+0r^65+0r^64+0r^63+0r^62+0r^61+0r^60+0r^59+0r^58+0r^57+0r^56+0r^55+0r^54+0r^53+0r^52+0r^51+0r^50+0r^49+0r^48+0r^47+0r^46+0r^45+0r^44+0r^43+0r^42+0r^41+0r^40+0r^39+0r^38+0r^37+0r^36+0r^35+0r^34+0r^33+0r^32+0r^31+0r^30+0r^29+0r^28+0r^27+0r^26+0r^25+0r^24+0r^23+0r^22+0r^21+0r^20+0r^19+0r^18+0r^17+0r^16+0r^15+0r^14+0r^13+0r^12+0r^11+0r^10+0r^9+0r^8+0r^7+0r^6+0r^5+0r^4+0r^3+0r^2+0r+0
    
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Normally this would be a suggestion, but in this case I think it warrants an issue:

    all of the coordinates that contain the given value and are connected to the original coordinate by the given value.

    I had the hardest time understanding what "connected by the given value" means, until someone explained to me it means "adjacent". The fact that it is already stated that the coordinates shall contain the given value led me to believe that "connected ... by the given value" meant some special definition of "connected". It doesn't, it's just a redundant expression.

    Can the description please be modified to state something like:

    "... of all the coordinates that contain the given value and are connected to the original coordinate via adjacency/moore neighbourhood..."

    Also, though not related: this is pretty much just a duplicate of any of multitude of path finding kata.

  • Custom User Avatar

    COBOL translation (author is inactive).

  • Custom User Avatar

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

  • Custom User Avatar

    Good kata!
    Still, I'd prefer to see example with -x and big numbers in initial unit tests.
    For example:

    Assert.AreEqual("-x+1", KataSolution.Expand("(-x+1)^1"));
    Assert.AreEqual("y^15-75y^14+2625y^13-56875y^12+853125y^11-9384375y^10+78203125y^9-502734375y^8+2513671875y^7-9775390625y^6+29326171875y^5-66650390625y^4+111083984375y^3-128173828125y^2+91552734375y-30517578125", KataSolution.Expand("(y-5)^15"));                             
    
  • Custom User Avatar

    CoffeeScript translation kumited

    please scrutinize for approval.

  • Default User Avatar

    Natural numbers normally don't include 0...

  • Custom User Avatar

    You should add random test cases. In its current state, it can be hardcoded: https://www.codewars.com/kata/reviews/5404b3f39f21e1b6f500012d/groups/5e51f1c077d51a000155e69c

  • Custom User Avatar

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

  • Default User Avatar

    Duplicate

    • this is older, so technically this should be approved

    • however new versions are already approved and have more translations

    There needs to be some kind of policy for cleanup in these cases.

  • Loading more items...