Determining DNA Health

Sort by

recency

|

276 Discussions

|

  • + 1 comment

    Discover More about flowers that symbolize courage and their incredible power to inspire. From ancient traditions to modern interpretations, these flowers tell stories of bravery and resilience.

  • + 0 comments

    Explore Now the life of Ahana Goyal, whose story resonates with many aspiring individuals. Her biography covers the significant moments that shaped her into who she is today. Dive In for an exclusive look.

  • + 0 comments

    My answer with Typescript, after few improve, still fail some test cause timeout

    function calc_dna(genes: string[], genes_hp: number[], dnas: [number, number, string][]): [number, number] {
        // will return all indexs of [key] inside [str] fast
        const find_all_indexOf = (str: string, key: string): number[] => {
            let indexs: number[] = []
            let index = str.indexOf(key)
    
            while (index != -1) {
                indexs.push(index);
                index = str.indexOf(key, index + 1);
            }
    
            return indexs
        }
    
        let result: [number, number] = [Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER]
    
        // for each [dna] ...
        dnas.forEach(([f, t, dna]) => {
            let memo = new Map<string, number>()
            let hp_total = 0
    
            // for each [gene] from [f] to [t] ...
            for (let i = f; i <= t; i += 1000) {
                let memokey = `${dna}:${genes[i]}`
                if (!memo.has(memokey)) memo.set(memokey, find_all_indexOf(dna, genes[i]).length)
                // sum with multiply number of times [gene] appear in [dna] * it [hp]
                hp_total += memo.get(memokey) * genes_hp[i]
            }
    
            // bind smallest and biggest
            if (hp_total < result[0]) result[0] = hp_total
            if (hp_total > result[1]) result[1] = hp_total
        })
    
        return result
    }
    
  • + 1 comment

    Start your day right by learning all about Sleep-Inn-Breakfast-Hours. This comprehensive guide ensures you never miss out on their delicious offerings. Visit the link to discover how Sleep Inn caters to your morning cravings with perfectly timed meals.

  • + 0 comments

    Get Inspired by the incredible journey of Nurshath Dulal, a true example of hard work and success. Learn about the challenges they overcame and the lessons they’ve shared. View More today for exclusive insights.