Write a program in a language of your choice to find the critical path from a given set of tasks.
A critical path is determined by identifying the longest stretch of dependent activities and measuring the time required to complete them from start to finish.
Each circle (A-G) are tasks with specific duration (in Hours).
Input:
Array of task names and duration given in the diagram.
Output
1. Longest path (Critical path) is A+G+B+F+C+D (42Hrs)
2. Shortest path is A+B+C+D (26 Hrs)