Click here to Skip to main content
15,887,746 members
Home / Discussions / Java
   

Java

 
GeneralRe: how do i fix this array out of bound index Pin
divinity0215-Mar-16 21:46
divinity0215-Mar-16 21:46 
AnswerRe: how do i fix this array out of bound index Pin
Patrice T16-Mar-16 16:26
mvePatrice T16-Mar-16 16:26 
GeneralRe: how do i fix this array out of bound index Pin
divinity0217-Mar-16 9:51
divinity0217-Mar-16 9:51 
QuestionNew To Java Pin
aahamdan13-Mar-16 4:15
aahamdan13-Mar-16 4:15 
AnswerRe: New To Java Pin
Richard MacCutchan13-Mar-16 7:13
mveRichard MacCutchan13-Mar-16 7:13 
Questionjava Pin
Member 1238766612-Mar-16 8:14
Member 1238766612-Mar-16 8:14 
AnswerRe: java Pin
Richard MacCutchan13-Mar-16 0:10
mveRichard MacCutchan13-Mar-16 0:10 
QuestionUsing recursion Pin
Member 1238223510-Mar-16 18:42
Member 1238223510-Mar-16 18:42 
Quote:
students have so much free time on their hands that they drew a big jumping game outside the college entrance. There are very large numbers written on the ground as follows:

4 1 5 2 6 3 4 2 0

The number, with a square around it, indicates where you are currently standing. You can jump left or right down the line by jumping the number of spaces indicated by the number you are standing on. So if you are standing on a 4, you can jump either left 4 spaces or right 4 spaces. *BUT: You cannot jump past either end of the line.

For example, the first number (4) only allows you to jump right, since there are no numbers to the left that you can jump to.

The goal: you want to get to the 0 at the far end (right side) of the line. You are also guaranteed that there will be only one zero, which, again, will be at the far right side.

Here is how you do that with the above line:

Starting 4 4 1 5 2 6 3 4 2 0
position
Step 1: 4 4 1 5 2 6 3 4 2 0
Jump right
Step 2: 4 4 1 5 2 6 3 4 2 0
Jump left
Step 3: 4 4 1 5 2 6 3 4 2 0
Jump right

Step 4: 4 4 1 5 2 6 3 4 2 0
Jump right
Step 5: 4 4 1 5 2 6 3 4 2 0
Jump left
Step 6: 4 4 1 5 2 6 3 4 2 0
Jump right

Some FCITgame lines have multiple, correct paths to 0 from the given starting point. Other lines have no paths to 0, such as the following:

1 2 3 0

In this line, you can jump between the 3's, but not anywhere else. So this will return false. You are to write a recursive method that will return a boolean (true or false) to show if we can solve the game (if we can get to the rightmost 0). If we can get to the zero, then your method should return true. If we cannot get the rightmost 0, then the method should return false.

AnswerRe: Using recursion Pin
Richard MacCutchan10-Mar-16 21:25
mveRichard MacCutchan10-Mar-16 21:25 
GeneralRe: Using recursion Pin
Member 1238223510-Mar-16 22:15
Member 1238223510-Mar-16 22:15 
GeneralRe: Using recursion Pin
Richard MacCutchan11-Mar-16 2:36
mveRichard MacCutchan11-Mar-16 2:36 
AnswerRe: Using recursion Pin
Patrice T16-Mar-16 15:26
mvePatrice T16-Mar-16 15:26 
QuestionDoubt regarding Java coding Pin
Sweacha Nlakshmi10-Mar-16 18:16
Sweacha Nlakshmi10-Mar-16 18:16 
GeneralRe: Doubt regarding Java coding Pin
Richard MacCutchan10-Mar-16 21:24
mveRichard MacCutchan10-Mar-16 21:24 
Questioncoffee shop management system in java Pin
Hussain Anwer6-Mar-16 2:52
Hussain Anwer6-Mar-16 2:52 
AnswerRe: coffee shop management system in java Pin
Richard MacCutchan6-Mar-16 4:20
mveRichard MacCutchan6-Mar-16 4:20 
QuestionCustom Browser Pin
sandeep kamara26-Feb-16 18:06
sandeep kamara26-Feb-16 18:06 
AnswerRe: Custom Browser Pin
Richard MacCutchan26-Feb-16 21:57
mveRichard MacCutchan26-Feb-16 21:57 
Questioncore java (Singleton pattern ) Pin
Hiren Akbari25-Feb-16 6:45
professionalHiren Akbari25-Feb-16 6:45 
AnswerRe: core java (Singleton pattern ) Pin
NickPace25-Feb-16 7:00
NickPace25-Feb-16 7:00 
QuestionHow to use setters and getters. Pin
Member 1234728623-Feb-16 14:49
Member 1234728623-Feb-16 14:49 
AnswerRe: How to use setters and getters. Pin
Richard MacCutchan23-Feb-16 21:26
mveRichard MacCutchan23-Feb-16 21:26 
GeneralMessage Closed Pin
25-Mar-20 19:16
Sherin_Mathew25-Mar-20 19:16 
GeneralRe: How to use setters and getters. Pin
Richard MacCutchan25-Mar-20 21:29
mveRichard MacCutchan25-Mar-20 21:29 
GeneralRe: How to use setters and getters. Pin
OriginalGriff16-Apr-20 0:06
mveOriginalGriff16-Apr-20 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.