• 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
jas14 Avatar
Name:Joe Stein
Clan:Facebook
Member Since:Jul 2018
Last Seen:Oct 2024
Profiles:
Following:126
Followers:127
Allies:125
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (6)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • faruby86
    • commented on "Maximum subarray sum" ruby solution
    • 3 years ago

    I'm not educated in programing, but isn't that n^3 becouse of .sum? slice is just "one time" (or how I should call it) opearation.

  • Custom User Avatar
    • jas14
    • commented on "Maximum subarray sum" ruby solution
    • 6 years ago

    You're right, missed that slice and just assumed it was a straight iteration over the original... even slower!

  • Custom User Avatar
    • FArekkusu
    • commented on "Maximum subarray sum" ruby solution
    • 6 years ago

    It's O(n^3) due to a slice inside the 2-level for loop.

  • Custom User Avatar
    • jas14
    • commented on "Descending Order" ruby solution
    • 6 years ago

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

  • Custom User Avatar
    • jas14
    • commented on "Maximum subarray sum" ruby solution
    • 6 years ago

    This is still O(n^2) - the worst case is when there are no negative numbers.

  • Custom User Avatar
    • jas14
    • commented on "Maximum subarray sum" ruby solution
    • 6 years ago

    You don't have to return early in the empty array case ;) but other than that, this is the most concise and readable linear-time solution.

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

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...