Skip to content

Instantly share code, notes, and snippets.

View Avdesh02's full-sized avatar

Avdesh Kumar Sharma Avdesh02

  • TCS
View GitHub Profile
@Avdesh02
Avdesh02 / codechef.py
Created June 25, 2021 06:47
My code runs fine while testing 1 Test case but fails while submit code
'''
This is the problem:
Given an undirected and connected graph of N vertices and N-1 edges.
The number written on the ith vertex is val[i]. The task is to count
the number of pairs(x,y) such that the following conditions are satisfied:
0 ≤ x < y ≤ N-1
The GCD of the numbers written on the vertices on the simple path in the given graph from x to y should be divisible by K.
For Example: