We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Data Structures
  3. Arrays
  4. Array Manipulation
  5. Discussions

Array Manipulation

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • m_zayed 2 years ago+ 3 comments

    Python 3 more clear code

    def arrayManipulation(n, queries):
        
        my_array = [0] * (n+1)
        count = 0
        temp = 0
        for first,last,value in queries:
            
            my_array[first-1] += value
            my_array[last] -= value
        
        for item in my_array:
            count += item
            if count > temp:
                temp = count
           
        return temp
    
    8|
    ParentPermalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature