Blogs Hub

by AskGif | Oct 05, 2020 | Category :coding

Maximize Sum Of Array After K Negations - Greedy - Easy - LeetCode

Maximize Sum Of Array After K Negations - Greedy - Easy - LeetCode

Given an array A of integers, we must modify the array in the following way: we choose an i and replace A[i] with -A[i], and we repeat this process K times in total.  (We may choose the same index i multiple times.) Return the largest possible sum of the array after modifying it in th

read more...

by AskGif | Jan 03, 2019 | Category :coding

What is a Heap?

What is a Heap?

A heap is a tree with some special properties. The basic requirement of a heap is that the value of a node must be > (or <) than the values of its children. This is called heap property. A heap also has the additional property that all leaves should be at h or h – 1 le

read more...