Sort by

recency

|

72 Discussions

|

  • + 1 comment

    Interesting problem on efficient pattern detection! It reminds me of the care philosophy behind germistonvet, where precision and compassion go together—step into a world of compassion and expertise, where every tail wag and purr is cherished, and pets receive the highest quality care they deserve.

  • + 0 comments

    Here is solution in python, java, c++, c and javascript programming - https://programmingoneonone.com/hackerrank-save-humanity-problem-solution.html

  • + 0 comments

    C+

    include

    include

    include // for memcmp

    include // for size_t

    using namespace std;

    // Recursive function to count mismatches between two substrings size_t get_mismatch_count(const char *r, const char *l, size_t s) { size_t res = 0; if (s < 1) return res;

    if (s == 1) {
        if (memcmp(r, l, s)) res = 1;
        return res;
    }
    
    size_t m = s / 2;
    const char *r_n = r + m;
    const char *l_n = l + m;
    size_t m_n = s - m;
    
    bool mismatch_l = false, mismatch_r = false;
    
    if (memcmp(r, l, m)) mismatch_l = true;
    if (memcmp(r_n, l_n, m_n)) mismatch_r = true;
    
    if (mismatch_l && mismatch_r) {
        res = 2;
        return res;
    }
    
    if (mismatch_l) res += get_mismatch_count(r, l, m);
    if (mismatch_r) res += get_mismatch_count(r_n, l_n, m_n);
    
    return res;
    

    }

    // Main logic for the virus indices problem void virusIndices(string p, string v) { const string no_match = "No Match!"; size_t p_s = p.size(); size_t v_s = v.size(); bool match_found = false;

    for (size_t i = 0; i + v_s <= p_s; ++i) {
        size_t mismatch_count = 0;
    
        if (memcmp(p.c_str() + i, v.c_str(), v_s) == 0) {
            mismatch_count = 0; // Exact match
        } else {
            mismatch_count = get_mismatch_count(p.c_str() + i, v.c_str(), v_s);
        }
    
        if (mismatch_count <= 1) {
            cout << i << " ";
            match_found = true;
        }
    }
    
    if (!match_found) cout << no_match;
    cout << endl;
    

    }

    // Main function to handle multiple test cases int main() { ios::sync_with_stdio(false); cin.tie(nullptr);

    int t;
    cin >> t;
    
    while (t--) {
        string p, v;
        cin >> p >> v;
        virusIndices(p, v);
    }
    
    return 0;
    

    }

  • + 0 comments

    Wow, just like how doctors need to detect tiny virus DNA patterns quickly to save lives, I recently realized how important it is to catch health issues early too. That’s why I searched for a Chiropractor near me and found At Ace Chiropractic. Their team uses evidence-based care and state-of-the-art technology to help patients regain their health—just like pinpointing the exact problem in a patient’s DNA. It’s amazing to see such precision applied to real-life health!

  • + 0 comments

    Wow, this virus detection problem reminds me how important precision is, whether in DNA analysis or in healthcare. Speaking of care, I recently found a chiropractor near me in New Albany who uses advanced, gentle techniques. Just like detecting small differences in DNA, their targeted adjustments are precise and comfortable, helping realign my spine and support natural healing without harsh treatments.