We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Graph Theory
  4. Jogging Cats
  5. Discussions

Jogging Cats

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 18 Discussions, By:

recency

Please Login in order to post a comment

  • yashparihar729
    4 months ago+ 0 comments

    Here is my solution in java, javascript, python C, C++, Csharp HackerRank Jogging Cats Problem Solution

    0|
    Permalink
  • mineman1012221
    6 months ago+ 0 comments

    Here is the solution of Jogging Cats Click Here

    0|
    Permalink
  • thecodingsoluti2
    8 months ago+ 0 comments

    Here is problem solution - https://programs.programmingoneonone.com/2021/07/hackerrank-jogging-cats-problem-solution.html

    0|
    Permalink
  • eiduladh_a_wish1
    8 months ago+ 1 comment

    The scottish fold munchkin is a pretty healthy breed, but there are some hereditary health problems in the breed: Osteochondrodysplasia, a developmental abnormality that affects cartilage and bone development. Polycystic kidney disease (PKD) Cardiomyopathy, a form of heart disease.

    -2|
    Permalink
  • konetikirankumar
    10 months ago+ 1 comment

    c++

    #include <iostream>
    #include <cmath>
    #include <cstring>
    #include <queue>
    #include <vector>
    #include <cstdio>
    #include <map>
    #include <stack>
    #include <set>
    #include <algorithm>
    #define ll long long
    using namespace std;
    const int Maxn = 100010 , Maxm = 11, Mo = 1e9 + 7;
    const ll oo = 1ll << 60;
    #define PB push_back
    
    int T, cs = 1;
    int n , m , k;
    vector<int> e[Maxn];
    int cnt[Maxn];
    int main(){
        cin >> n >> m;
        for (int i = 1, u, v; i <= m; i++){
            cin >> u >> v;
            e[u].PB(v);
            e[v].PB(u);
        }
        ll ans = 0;
        for (int u = 1; u <= n; u++){
            vector<int> all;
            for (int i = 0; i < e[u].size(); i++){
                int v = e[u][i];
                for (int k =0; k < e[v].size(); k++){
                    int t = e[v][k];
                    if (t == u) continue;
                    if (cnt[t] == 0) all.PB(t);
                    ans += cnt[t];
                    cnt[t] ++;                
                }
            }
            for (int i = 0; i < all.size(); i++) cnt[all[i]] = 0;
        }
        cout << ans / 4 << endl;
    }
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy