This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!

Sabrina Cux

+ Follow
since Jun 10, 2019
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sabrina Cux

Hi everyone, I need to connect Django server with Vuejs frontend dashboard. Both of them are already built, I've done the vuejs part, and I need to access the already built api requests in django. Don't really know where to start. If someone could give me guidance.... Thank you so much...
Hello guys,
I'm just starting with vue.js following the Free Code Camp tutorial. My problem is, after I run the terminal asks me few questions like the name of the project and project description. It then stops here (at Project Description). I can't just click enter to keep the default one, nor typing a new one, it gets like stuck at this point: I tried updating anything I think it could relate to it, but everytime it stops at project description.
I can't find anything on google. Can someone help me, please?
Thank you in advance.

Dave Tolls wrote:

Sabrina Cux wrote:
I tried that but, in both cases (pair[0]=numbers[right] or just right) it gives me back a dirty array, like This is my issue.

That's because that's the default output from an array.
If you want the contents then use:

Thank you so much!
2 months ago

Piet Souris wrote:In the code of your opening post, in line 15, you have:

that's why I asked.

For instance, if the array = {4, 4, 4, 4} and the required sum = 8, what would you return?

"Target will always be the sum of two different items from that array." This is just an exercise to practice.  I guessed it means two different values, as they can't have same indexes.
2 months ago

E Byrne wrote:Just change "numbers[left]" to "left" on Line 19,  "numbers[right]" to "right" on Line 20, analogous to the changes on Lines 21 and 22?

I tried that but, in both cases (pair[0]=numbers[right] or just right) it gives me back a dirty array, like This is my issue.
2 months ago

Piet Souris wrote:hi Sabrina,

a question: must you return two different indices or two different values?
You can simplify your code by using a suitable version of Arrays.binarySearch.

I need the two differente indexed (whose summed values are equal to the target).
2 months ago

E Byrne wrote:I was going to suggest then referencing the array returned from the method call and printing the indices that have been put in the 2-element array:

but I realise see the numbers are 0 and 1, rather than the 0 and 2 that I would have expected. (Same as printed from within the method). So I'm not sure if the code is doing what you want. I haven't thought too much about the logic, as I got a bit lost on initial think-through)

Yes, I noticed that too. But I soon found out that was because of on line 10, I removed it and it's working fine now.
2 months ago
Ok, I got my misunderstanding, if I type I get printed just the indexes (and not their values), but I don't need them printed, I need them inside the pair array. Is there any way to achieve that, without changing the whole code?
2 months ago

Dave Tolls wrote:But you're setting them to numbers[left] and numbers[right].
What are those values?

The values are the index values. If you remove the comments on lines 21 22 you can see they get printed. How to have them inside pair? I am probably confusing something here...
2 months ago

Dave Tolls wrote:And on lines 19 and 20 what values are you putting in that array?

The two supposed found indexes if(sum == target) then I should have found the indexes, and I need to add them to the array returned by the method as requested.
2 months ago

Campbell Ritchie wrote:Please explain what the pair array is supposed to contain. I don't think it contains what you think it does.

The pair should contain the 2 indexes of the two different items of the array passed in the method that, when added together, give the target value.
2 months ago
I need to implement a method that takes an array of numbers (integers for the tests) and a target number. It should find two different items in the array that, when added together, give the target value. The indices of these items should then be returned in an array like so: [index1, index2].
The input will always be valid (numbers will be an array of length 2 or greater, and all of the items will be numbers; target will always be the sum of two different items from that array).
My work so far:

The method works, I manage to get the two required indexes, but I can't find a way to add them to the pair array (lines 21-22 do not work as I expected them to).
Can someone help, please?
2 months ago
For solving Case Sensitivity:
Just added str.toLowerCase() before doing any operation on the string. That should be enough.
2 months ago

salvin francis wrote:I think my code would only fail for "moOse" since my code does not ignore case. It should also work for blank string so no blank check is required.
Can you work out a case-insensitive solution ?

Yep!!! Your code does work! Thanks for your solution, my way keeps its mystery.
2 months ago

Campbell Ritchie wrote:

Sabrina Cux wrote:. . . for the last line . . .

You know == doesn't work on Strings.

Aaahh my bad! Changed, but the issue was not that one. And thanks for the link as refresh!
2 months ago