Dataford
Interview Guides
Upgrade
All questions/Coding/Maximize Sum After K Reversals

Maximize Sum After K Reversals

Medium
Coding
Asked at 1 company1ArraysLinked Lists
Also asked at
Integra Micro Software Services (P)

Problem

Given an integer array nums and an integer k, perform exactly k sign reversals on elements of the array. Each reversal toggles one element from positive to negative or negative to positive. Return the maximum possible sum of the array after all reversals.

Problem

Given an integer array nums and an integer k, perform exactly k sign reversals on elements of the array. Each reversal toggles one element from positive to negative or negative to positive. Return the maximum possible sum of the array after all reversals.

Practice Python
Python 3.10
Open on desktop for the full Python editor with syntax highlighting and autocomplete.
Up next
OMaximum Subarray SumMediumMetaMaximum Sum Subarray in ReelsMediumMetaKth Largest Feed ScoreMedium
Next question