Expert Answer
function frequncyOfMixmumValue(numbers, q) {
let NumbersWithoutUndefiend = numbers.filter((item) => (item = !undefined));
let numberOfQuiry = q.length;
let frequncyOfMixmumArray = [];
const frequncyOfMixmumValueForQuiry = (numbers) => {
let max = Math.max(...numbers);
let frequncyOfMixmum = 0;
numbers.forEach((item) => {
item === max ? frequncyOfMixmum++ : "";
});
frequncyOfMixmumArray.push(frequncyOfMixmum);
numberOfQuiry--;
numbers.shift();
numbers.length === 0 || numberOfQuiry === 0
? ""
: frequncyOfMixmumValueForQuiry(numbers);
};
frequncyOfMixmumValueForQuiry(NumbersWithoutUndefiend);
return frequncyOfMixmumArray;
}
Got any questions or additions? Please let me know.
Thank you for reading :)
Top comments (0)