Arrays Comments
Comments
-
I got the answer in the end, but my first attempt was:
int CC = ar[ar.length-1];
int VV = ar[0];
return CC + VV; -
Didn't work :(
-
@Aaron, I added a little more hint and an explanation.
-
int[] fl = new int[2];
fl[0] = ar[0];
fl[1] = ar[ar.length - 1];
return fl; -
Thanks for the site I am really learning from it.
One thing I'd like to be able to do is practice typing things out as I'm following along with your explanations. I think it would help reinforcethe information. Could you add blank text entry fields (not compilers) here and there in the lesson to give the user scratch space?
-
@Robin, if you just want to take notes I think it would make sense to do in your own note-taking program, though we can consider adding such a feature. Note that if you click on "split-screen
view", you can view the code editor and content side-by-side, which may work for your purpose. And if you decide you want to run different code snippets, you can try the visual debugger (launched yesterday).
-
Just a funny quote here... On the challenge Second-to-Last i scratched my head for two days trying to think how to declare the variable in a single sentence the reason was because i was understanding: from the second (meaning starting at index 1) to the last, rather than actually thinking about penultimate! Frustrated not being able to declare the variable i decided that i was not understanding the exercise, clear enough google explained me second-to-last=penultimate... OMG LOL
Pura vida.
-David
-
What does "Second to last" mean?
-
HOLY MOLY. 2D ARRAYS MADE MY SUDOKU SOLVER EASIER!
-
And here is the answer for the challenge:
int [] ars = {ar [0], ar [ar.length -1]};
return ars; -
these are very good
-
If you get a number from an array, and do not know what slot its in. Is there a code to retrieve the slot?
Example;
I found the largest number in the array and want to know what slot that is in. -
I don't understand why my challenges are wrong:
1. int n = numbers[6];
2. boolean [] frank= new boolean [6]; -
I had the write awnser but it still does not work, what is wrong in this:
int[] ar2 = new int[2];
ar2[0] = ar[0];
ar2[1] = ar[ar.lenght - 1];
return ar2; -
sorry i solved it lenght mus be length pfffffffffffff :-)
-
Is the free memebership limit forever? Doesn't it restore after certain time?
-
It doesn't currently restore since it's considered a free trial.
-
Or declare regular variables:
int a = ar[0];
int b = ar[ar.length -1];
int[] az = {a,b};return az;
-
Second-to-last means, the second element in the array starting counting from the last index.
-
import java.util.Scanner;
public class Main(){
public static void main(String[] args){
int n;
int[] numbers= new int[8];
int[] numbers={2,3,4,5,6,7,8,9};
for(int i=0;i<8;i=i+1){
System.out.print(numbers[i]);
if(i==6){
n=numbers[i]
System.out.print(n);
}
}
}
} -
Do it easy guys ...
int[] res = {ar[0], ar[ar.length -1]};
return res;
Aaron Archer
Sep 26, 7:40 AMIs there any possible way of making the cheat possible on some of these? All it will let me do is see the hint but won't ever show the cheat button. Fair enough that it's wrong to cheat but since
I can't figure out how to do it at all, I have to click next to carry on and never know what the correct answer is.