• 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
deadem Avatar
Name:Unknown
Clan:Unknown
Member Since:Jan 2015
Last Seen:Jul 2024
Profiles:
Following:1
Followers:2
Allies:0
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (33)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • Gon_Yassine
    • commented on "Sum of positive" cpp solution
    • 14 months ago

    The first call to Lambda Function by std::accumulate uses the initial value 0 as 'a' and the first element of the vector as 'b'.

    for these ex : std::vector{-1, 2, 3, 4, -5};

    first imple : a = 0, b = -1 ==> resul a + std::max(0, b) = 0 + 0 = 0; then store the result to a.

    Second imple : a = 0, b = 2 ==> resul a + std::max(0, b) = 0 + 2 = 2; then store the result to a.
    .....

  • Custom User Avatar
    • o2001
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    The STL has built-in stuff for a reason. This is exactly what this function is used for.

  • Custom User Avatar
    • CReszen
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    whats part you didnt get it ?

  • Custom User Avatar
    • Abdelaziem06
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    I can't understand this solution

  • Custom User Avatar
    • Abdelaziem06
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    I can't understand this solution

  • Custom User Avatar
    • deadem
    • commented on "Sum of positive" cpp solution
    • 2 years ago

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

  • Custom User Avatar
    • ipsavitsky
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    yeah, but at some point parallel execution_police becomes benefitial

    P.S. we would have to replace accumulate with reduce

  • Custom User Avatar
    • nfsim
    • commented on "Sum of positive" cpp solution
    • 2 years ago

    max(0, b) is very clever!

  • Custom User Avatar
    • rspx
    • commented on "Sum of positive" cpp solution
    • 3 years ago

    this approach is interessant from STL perspective but less performant than iterating through the vector with for() loop

  • Custom User Avatar
    • Hunter95
    • commented on "Sum of positive" cpp solution
    • 4 years ago

    or kill a mosquito using a cannon.

  • Custom User Avatar
    • cullyn
    • commented on "Moves in squared strings (I)" javascript solution
    • 4 years ago

    I was wondering what the point of the higher order function was, but clearly it turned 4 lines of repeated code into 1. Had to change my solution to this one!

  • Custom User Avatar
    • erikzenker
    • commented on "Sum of positive" cpp solution
    • 7 years ago

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

  • Custom User Avatar
    • mwiesing
    • commented on "Sum of positive" cpp solution
    • 7 years ago

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

  • Custom User Avatar
    • ___i
    • commented on ""Simple Pig Latin" PHP Translation"
    • 7 years ago

    description update is required before this can be approved. Change description to match.

  • Custom User Avatar
    • deadem
    • commented on "Coordinates Validator" kata
    • 8 years ago

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

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...