Simple C Solution using DFS
Code\n\n#define max(a,b) (a > b ? a : b)\n\nstruct ht_map{\n    struct ht_map* next;\n    int adj;\n    int time;\n};\n\nvoid find_path_dfs(struct ht_map** time
# Code\n```\n#define max(a,b) (a > b ? a : b)\n\nstruct ht_map{\n    struct ht_map* next;\n    int adj;\n    int time;\n};\n\nvoid find_path_dfs(struct ht_map** times, int* values, int size, int* visited, int* out, int max, int i, int time, int max_time){\n    if(time > max_time)\n        return;\n    if(visited[i] == 0)\n        max += values[i];\n\n    int j;\n\n    if(i == 0){\n        *out = max(*out, max);\n    }\n\n    visited[i]++;\n    if(times[i]){\n        struct ht_map *current = times[i];\n        while(current){\n            j = current->adj;\n            int new_time = time + current->time;\n            find_path_dfs(times, values, size, visited, out, max, j, new_time, max_time);\n            current = current->next;\n        }\n    }\n    visited[i]--;\n}\n\nint maximalPathQuality(int* values, int valuesSize, int** edges, int edgesSize, int* edgesColSize, int maxTime) {\n    if (valuesSize == 1){\n        return values[0];\n    }\n    int* out = malloc(sizeof(int));\n    *out = 0;\n    struct ht_map** times = malloc(valuesSize * sizeof(struct ht_map*));\n    int* visited = malloc(valuesSize * sizeof(int));\n    int i, j;\n    for (i = 0; i < valuesSize; i++){\n        times[i] = NULL;\n        visited[i] = 0;\n    }\n    \n    for (i = 0; i < edgesSize; i++){\n        struct ht_map *ins1, *ins2;\n        int src = edges[i][0];\n        int dst = edges[i][1];\n        int time = edges[i][2];\n\n        ins1 = malloc(sizeof(struct ht_map));\n        ins1->adj = dst;\n        ins1->time = time;\n        ins1->next = times[src];\n        times[src] = ins1;\n        \n        ins2 = malloc(sizeof(struct ht_map));\n        ins2->adj = src;\n        ins2->time = time;\n        ins2->next = times[dst];\n        times[dst] = ins2;\n    }\n\n    find_path_dfs(times, values, valuesSize, visited, out, 0, 0, 0, maxTime);\n\n    return *out;\n}\n```
['Array', 'Backtracking', 'Graph', 'C']