Ad
  • Custom User Avatar

    I am not sure what kind of "memory handling" or "memory optimization" you need to do, because it is definitely not the intention here. I checked a bunch of C# solutions, including mine old solution, and out of 10 solutions tested by me, all of them run in 3-3.5 seconds.

    We can use this as a starting point to make some conclusions :)

  • Custom User Avatar

    C# 12

    I don't know if I'm doing something very wierdly but the original test passes brilliantly but when trying to "attempt" it times out.

    Is the point of this to do memory handling or to make an interpreter? Because as it stands I've had to spend more time on learning memory optimization :/
    Unsure whether this is a CodeWars limitation and this Kata is simply too complex for CodeWars or if I'm just really dumb T_T

  • Custom User Avatar

    That is beyond confusing... I'm sure this solution is good, clever and all that but it takes serious dedication to understand what's going on whatwith all the single-letter variable names and a variable "sorted" that's supposedly... not sorted?..

  • Custom User Avatar

    It looks clean at first glance but the more I look the more i see inconsictencies:

    1. In the constructor we should really only take in data and confirm that we've recieved what we want(which in case of ItemsPerPage we do) but then we also handle data. It's more readable to move that into the methods.
    2. We lock access to this instance of the helpers collection to the constructor, which means that if in the future we'd need to do more things with it it's going to need refactoring anyways. IMO it'd be easier and more readable to assign the inputs to private readonly variables and then handle the data in the methods.
    3. PageItemCount is susceptible to a so-called "trainwreck": when you do too many operations on a single line it's almost impossible to find the point of failure if we get an exception from that line.
  • Custom User Avatar

    I mostly like this, only thing i feel is off is PageItemCount() as it's susceptible to becoming a trainwreck and is kinda hard to read. Other than that I like this.

  • Custom User Avatar

    ngl this is the most readable and clean version in my opinion. My only issue with it is that at a glance it looks like you're reversing a string and then making it inot an array just so you can make it into a different string. It feel like an extra step but is it cus string(the type) is immutable?