Thursday, August 18, 2011

3rd class

Today we did CodingBat nearHundred, Makes10, missing Char
Fortunately, I understood Makes10 because the question was really simple and clear.
However, I didn't perfectly understand missing Char, which was about the Kitten and the n value.
I mean, what is a char?
and what does a substring do?
I am so confused with those.

I also have a problem with understanding what the hell the question is asking me to do.
For example,
Given a non-empty string and an int n, return a new string where the char at index n has been removed. The value of n will be a valid index of a char in the original string (i.e. n will be in the range 0..str.length()-1 inclusive).

missingChar("kitten", 1) → "ktten"
missingChar("kitten", 0) → "itten"
missingChar("kitten", 4) → "kittn"

what is a index n?
Well...at least I have a star lol

Java > Warmup-1 chance


Java > Warmup-1 > sumDouble
prev | next | chance

Given two int values, return their sum. Unless the two values are the same, then return double their sum.

sumDouble(1, 2) → 3
sumDouble(3, 2) → 5
sumDouble(2, 2) → 8

what does return their sum?

No comments:

Post a Comment