Max Routes With Budget

You are given n cities numbered from 0 to n - 1, an array routes where each entry [u, v, cost] is a road joining city u and city v that costs cost to travel, and an integer budget. You begin at city 0 and may travel along any roads, in any direction, as long as your total travel cost stays within budget. Return the maximum number of distinct destination cities selected as stops, counting city 0 as the initial selected stop. A city used only as an intermediate transit point is not counted unless it is selected as a stop. You do not have to return to city 0.

Examples
Input: [3,[[0,1,10],[1,2,20]],30]
Output: 3
Hints

Max Routes With Budget

You are given n cities numbered from 0 to n - 1, an array routes where each entry [u, v, cost] is a road joining city u and city v that costs cost to travel, and an integer budget. You begin at city 0 and may travel along any roads, in any direction, as long as your total travel cost stays within budget. Return the maximum number of distinct destination cities selected as stops, counting city 0 as the initial selected stop. A city used only as an intermediate transit point is not counted unless it is selected as a stop. You do not have to return to city 0.