Given tree node values only in range 1 to N, find the number of trees possible with constraints on adjacent node values (e.g. must not be divisible by each other).
Asked in the coding round stage. SCE HackerEarth coding round.
Implement count_trees(n, k). Count every undirected tree whose k distinct node values are selected from 1..n. An edge is valid only when neither endpoint divides the other. Return the total count.
def count_trees(n, k):