Company: PayPal SWE Intern_30oct
Difficulty: medium
Profitable Journey Problem Description A traveler moves through cities represented by an array of integers, where each integer indicates the money spent (negative) or earned (positive) in that city per day. The journey starts at city 0 and ends at city (n-1). The traveler can move to either an adjacent city or a city that is p steps away, where p is any prime number ending in 3. Determine the maximum money the traveler can have at the end of the journey. Example cities = [10, 200, -200, -50, 100, -80] The optimal journey results in a total amount of 100. The traveler starts from the 0th city, moves to the 1st and earns 100, moves to 2nd city to get 100+200 = 300, then to the 2+3= 5th city to get 300 + (-50) = 150, then to the 6th city, to get 150 + (-80) = 100. The traveler only moves to (i+p) or (i-p) cities since 3 is the only prime that ends with the digit 3 in the range of the array cities. Function Description Complete the function optimalJourneyTotal in the editor with the follow