`{"id":"05893912-ee7a-417e-8312-f74c31e34c3d","name":"Print All Paths With Minimum Jumps","description":"1. You are given a number N representing number of elements.\r\n2. You are given N space separated numbers (ELE : elements).\r\n3. Your task is to find & print \r\n 3.1) \"MINIMUM JUMPS\" need from 0th step to (n-1)th step.\r\n 3.2) all configurations of \"MINIMUM JUMPS\".\r\nNOTE: Checkout sample question/solution video inorder to have more insight.","inputFormat":"A number N (representing \"NUMBER OF ELEMENTS\").\r\nELE1 ,ELE2 ,ELE3 ,ELE4 .... ELEn (N space separated numbers represnting numbers).","outputFormat":"1) A number representing \"MINIMUM JUMPS\" need from 0th step to (n-1)th step.\r\n2) Strings representing configurations of \"MINIMUM JUMPS\".\r\nCheck the sample ouput and question video.","constraints":"1 &lt;= N &lt;= 100\r\n1 &lt;= ELE &lt;= 1000","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.ArrayDeque;\r\nimport java.util.Queue;\r\nimport java.util.Scanner;\r\n\r\npublic class Main{\r\n public static void Solution(int arr[]){\r\n // write your code here\r\n }\r\n public static void main(String []args){\r\n Scanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n\r\n int arr[] = new int[n];\r\n for(int i = 0 ; i < n ; i++)\r\n arr[i] = scn.nextInt();\r\n\r\n Solution(arr);\r\n scn.close();\r\n }\r\n}\r\n"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"10\r\n3\r\n3\r\n0\r\n2\r\n1\r\n2\r\n4\r\n2\r\n0\r\n0","sampleOutput":"4\r\n0 -> 3 -> 5 -> 6 -> 9 .\r\n0 -> 3 -> 5 -> 7 -> 9 .\r\n","questionVideo":"https://www.youtube.com/embed/phgjL7SbsWs?end=72","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"39c90b12-6160-4283-afb8-1b49c717a726","name":"Print All Paths With Minimum Jumps","slug":"print-all-paths-with-minimum-jumps","type":1}],"next":{"id":"8c35700c-212d-45c8-a910-1082944a20b3","name":"print all paths with minimum jumps MCQ","type":0,"slug":"print-all-paths-with-minimum-jumps-mcq"},"prev":{"id":"ccd36f4a-672f-4452-8a26-19ab9516503b","name":"Print all Paths with Maximum Gold","type":3,"slug":"print-all-paths-with-maximum-gold"}}}`

# Print All Paths With Minimum Jumps

1. You are given a number N representing number of elements. 2. You are given N space separated numbers (ELE : elements). 3. Your task is to find & print 3.1) "MINIMUM JUMPS" need from 0th step to (n-1)th step. 3.2) all configurations of "MINIMUM JUMPS". NOTE: Checkout sample question/solution video inorder to have more insight.

`{"id":"05893912-ee7a-417e-8312-f74c31e34c3d","name":"Print All Paths With Minimum Jumps","description":"1. You are given a number N representing number of elements.\r\n2. You are given N space separated numbers (ELE : elements).\r\n3. Your task is to find & print \r\n 3.1) \"MINIMUM JUMPS\" need from 0th step to (n-1)th step.\r\n 3.2) all configurations of \"MINIMUM JUMPS\".\r\nNOTE: Checkout sample question/solution video inorder to have more insight.","inputFormat":"A number N (representing \"NUMBER OF ELEMENTS\").\r\nELE1 ,ELE2 ,ELE3 ,ELE4 .... ELEn (N space separated numbers represnting numbers).","outputFormat":"1) A number representing \"MINIMUM JUMPS\" need from 0th step to (n-1)th step.\r\n2) Strings representing configurations of \"MINIMUM JUMPS\".\r\nCheck the sample ouput and question video.","constraints":"1 &lt;= N &lt;= 100\r\n1 &lt;= ELE &lt;= 1000","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.ArrayDeque;\r\nimport java.util.Queue;\r\nimport java.util.Scanner;\r\n\r\npublic class Main{\r\n public static void Solution(int arr[]){\r\n // write your code here\r\n }\r\n public static void main(String []args){\r\n Scanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n\r\n int arr[] = new int[n];\r\n for(int i = 0 ; i < n ; i++)\r\n arr[i] = scn.nextInt();\r\n\r\n Solution(arr);\r\n scn.close();\r\n }\r\n}\r\n"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"10\r\n3\r\n3\r\n0\r\n2\r\n1\r\n2\r\n4\r\n2\r\n0\r\n0","sampleOutput":"4\r\n0 -> 3 -> 5 -> 6 -> 9 .\r\n0 -> 3 -> 5 -> 7 -> 9 .\r\n","questionVideo":"https://www.youtube.com/embed/phgjL7SbsWs?end=72","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"39c90b12-6160-4283-afb8-1b49c717a726","name":"Print All Paths With Minimum Jumps","slug":"print-all-paths-with-minimum-jumps","type":1}],"next":{"id":"8c35700c-212d-45c8-a910-1082944a20b3","name":"print all paths with minimum jumps MCQ","type":0,"slug":"print-all-paths-with-minimum-jumps-mcq"},"prev":{"id":"ccd36f4a-672f-4452-8a26-19ab9516503b","name":"Print all Paths with Maximum Gold","type":3,"slug":"print-all-paths-with-maximum-gold"}}}`

Editor

# Print All Paths With Minimum Jumps

medium

1. You are given a number N representing number of elements. 2. You are given N space separated numbers (ELE : elements). 3. Your task is to find & print 3.1) "MINIMUM JUMPS" need from 0th step to (n-1)th step. 3.2) all configurations of "MINIMUM JUMPS". NOTE: Checkout sample question/solution video inorder to have more insight.

## Constraints

1 <= N <= 100 1 <= ELE <= 1000

## Format

### Input

A number N (representing "NUMBER OF ELEMENTS"). ELE1 ,ELE2 ,ELE3 ,ELE4 .... ELEn (N space separated numbers represnting numbers).

### Output

1) A number representing "MINIMUM JUMPS" need from 0th step to (n-1)th step. 2) Strings representing configurations of "MINIMUM JUMPS". Check the sample ouput and question video.

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}10 3 3 0 2 1 2 4 2 0 0```

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}4 0 -> 3 -> 5 -> 6 -> 9 . 0 -> 3 -> 5 -> 7 -> 9 . ```

Question Video

Discussions

Show Discussion

Related Resources