Super Hard Atlassian OA | How to solve ?

Revision en1, by LovesProgramming, 2024-09-23 16:16:34

This problem was asked recently in Atlassian OA.

Given an array ; in 1 operation you can add + 1 to any element of the array

This operation costs c[i] if you perform this operation on element at index "i"

Find minimum cost to make all array elements distinct

1<=N<=100000

1<=A[i]<=1000000000

1<=c[i]<=100000

Input —

A — [1 2 2] C — [1 100 500]

O/P — 100 — Do +1 operation on second element making the array — [1 3 2]

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English LovesProgramming 2024-09-23 16:16:34 532 Initial revision (published)