Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
1 like 0 dislike
3,762 views
in Interview-Experiences by Expert (108,110 points) | 3,762 views

1 Answer

0 like 0 dislike
Best answer

Find the number of journeys where you start from index 1 and end at index ‘n’ and the sum of every journey should be odd..

-> Similarly find for even. 

Allowed to make jumps of size 1 or 2 

5 4 2 6 

 

Number of odd sum journey : 

-> (5,2,6)

-> (5,4,2,6)

-> (5,4,6)

 

Number of even sum journey : 

-> Nothing 


 

2 3 5 8 10 

 

Evn sum journey

//evn

    //2...3...5...8...10

    //2...3...5.....10

 

Od sum journey : 

 

    

    //odd

    //2...5...10

    //2...3...8...10

    //2...5...8....10

Follow up question :-> You are allowed to make jumps of size 1,2,3.

by Expert (108,110 points)
edited by

Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .