• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
nhatlee Avatar
Name:lee
Clan:MonsterPixel
Skills:swift, objective-c, golang, c, c++, c#
Member Since:Jul 2017
Last Seen:Aug 2020
Profiles:
Following:1
Followers:0
Allies:0
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (9)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • KuuuGR
    • commented on "Find The Parity Outlier" swift solution
    • 2 years ago

    This solution is clear and concise, but it filters the entire array twice which is not optimal for large arrays.

  • Custom User Avatar
    • v_Aleksandr_v
    • commented on "Find The Parity Outlier" swift solution
    • 2 years ago

    What about memory usage? You can not create additional arrays.

  • Custom User Avatar
    • TarasEmti
    • commented on "Find The Parity Outlier" swift solution
    • 4 years ago

    Can be solved by searching through array only once. Why two filters solution is Best Practice?

  • Custom User Avatar
    • charliearaya
    • commented on "Find The Parity Outlier" swift solution
    • 6 years ago

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

  • Custom User Avatar
    • navigator
    • commented on "Financing Plan on Planet XY140Z-n" kata
    • 8 years ago

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

  • Custom User Avatar
    • BridgeTheGap
    • commented on "Multiples of 3 or 5" swift solution
    • 8 years ago

    "Most applications" is a very subjective phrase. I agree many premature optimizations are evil, but why waste time when the optimization is more like a logical solution than a weird tweak to match certain environment? FYI this solution takes around 500ms for 1 million. Not a huge number in the computer world I would say.

  • Custom User Avatar
    • heshamsalman
    • commented on "Multiples of 3 and 5" swift solution
    • 8 years ago

    I don't think there's any way to do this in constant time because you're asked to generate a list of m numbers up to an input n. You could absolutely do better than the filter/reduce combo, but I think this gets points for readability.

    At present, this has mn time, where n is the input and m is the number of items that match the criteria of being divisible by both 3 and 5. For most applications, the optimization to n time isn't worth it.

  • Custom User Avatar
    • JihadBadran
    • commented on "Multiples of 3 and 5" swift solution
    • 8 years ago

    why take O(n) when you can do it in constant time?

  • Custom User Avatar
    • nhatlee
    • commented on "Financing Plan on Planet XY140Z-n" kata
    • 8 years ago

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

  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...