Ad
  • Custom User Avatar

    I agree with antong01. This problem is best solved in O(n) by not sorting either array, but instead making use of a dictionary. Most of the solutions submitted either use sorting which results in O(n log n) or searching through an array, which results in O(n^2) overall. While simple and concise to write, they don't scale as well.

  • Default User Avatar

    While this is a simple solution, it has complexity of O(n log n); For big arrays it could be suboptimal if the first first element of a didn't have a match (no early return) or if b was an empty array

  • Custom User Avatar

    not enough tests: please use the python or java translation as reference.

  • Default User Avatar

    Add an example in Swift to the description.

  • Custom User Avatar

    Many thanks for taking the time to translate my Kata. The C code looks perfectly fine to me and I was about to approve it but unfortunately the CW system said that there were merge conflicts in the Kata description (because I approved your Swift translation first). For this reason, I have forked your translation to resolve the merge conflicts (and add a bit of C-specific information in the Description as well) and approved the fork instead, hope you don't mind :)

  • Default User Avatar

    I created the function in Swift and when i submit my code it passes all test except for "Multiply non-negative bytes with product less than 256". The exact error is 'XCTAssertEqual failed: ("Ã") is not equal to ("ÿ") -'. I saw the other question about code not passing this test so i changed it so my output was returned as a ISO_8859_1 return String(bytes: out_data, encoding: .isoLatin1 ) string but i am still getting exact same error. Any advice about where i have gone wrong would be much appriciated.