codinasion-archive / codinasion-monorepo

Community Monorepo
https://codinasion.org
MIT License
52 stars 170 forks source link

[Program]: efficency of FindTheMaximumSumOfAContiguousSubarray.js #4321

Closed pelegsch666 closed 9 months ago

pelegsch666 commented 1 year ago

What would you like to share?

i think there is another way to represent to the requested solution

Additional information

function getTheHighstSumInArr(arr): {
    const arrToWork = arr.sort((a, b) => a - b);
    [...new Set(arrToWork)];
    const arrToSum: number[] = [];
    let index = arr.length;
    for (let i = 0; i < 4; i++) {
      arrToSum.push(arrToWork[--index]);
    }
    const res = arrToSum.reduce((a, b) => {
      return a + b;
    });
    return res;
  }

Code of Conduct

codinasion-bot[bot] commented 1 year ago

👋🏻 Hey @pelegsch666

💖 Thanks for opening this issue 💖

A team member should be by to give feedback soon.

harisdev-netizen commented 1 year ago

Can I work on this issue?

swapnilmukherjee commented 10 months ago

!assign

harshraj8843 commented 9 months ago

This issue is now ready for contribution