Company: Tower Research

Difficulty: medium

Problem Statement

Tower Research operates a distributed network consisting of N servers connected by M bidirectional links. Each server must be assigned a value chosen from a given array A of K distinct integers. A network configuration is considered stable if for every communication link connecting servers u and v , the sum of the values assigned to the two servers is odd. Formally, for every link (u, v) : value[u] + value[v] is odd Given the network topology and the array of allowed values, determine the number of distinct stable configurations. Since the result can be very large, return the answer modulo 998244353 . Function Description Complete the function: int countStableConfigurations( int n, vector<vector<int>> links, vector<int> values ) Parameters n : Number of servers. links : A list of bidirectional links where links[i] = {u, v} indicates a connection between servers u and v . values : An array of K distinct integers. Each server can be assigned any one of these values. Ret

More Tower Research OA questionsInterview experiences