SUMMARYLet T be a tree in which every edge is associated with a real number. The sum of a path in T is the sum of the numbers associated with the edges of the path and its length is the number of the edges in it. For two positive integers L 1 ≤ L 2 and two real numbers S 1 ≤ S 2 , a path is feasible if its length is between L 1 and L 2 and its sum is between S 1 and S 2 . We address the problem: Given a tree T , and four numbers, L 1 , L 2 , S 1 and S 2 , find the longest feasible path of T . We provide an optimal O(n log n) time algorithm for the problem, where n = |T |.