1
var maxFrequency = function (nums, k) {2
// We sorted because as we are allowed only to increment the value & we try to increase the smaller el to some larger el3
nums.sort((a, b) => a - b);6
let max = Math.max(); // without any args, Math.max() is -Infinity8
// I have used 'for loop' so rightPtr is 'i' here9
for (let i = 0; i < nums.length; i++) {11
// decrement the winSize once the value required to convert could not be achieved even after utilizing K12
// (i-left+1) * nums[i] because we are converting every el upto that winSize by current el13
while ((i - left + 1) * nums[i] > curr + k) {16
max = Math.max(max, i - left + 1);