Win a copy of Microservices in Action this week in the Web Services forum!

since Mar 10, 2018

Cows and Likes

Cows

Total received

0

In last 30 days

0

Total given

0

Likes

Total received

2

Received in last 30 days

0

Total given

0

Given in last 30 days

0

Forums and Threads

Scavenger Hunt

Ranch Hand Scavenger Hunt

Greenhorn Scavenger Hunt

Please take participate in the following Survey and get a chance to win $25 Amazon gift card.

webpage

webpage

1 month ago

One of the input was 396285104 573261094 759641832 819230764 364801279.

Now, I used long int and it worked. Never Mind. Thank you very much for your quick response.

Now, I used long int and it worked. Never Mind. Thank you very much for your quick response.

3 months ago

Again. I'm sorry the program above does not work for all the test cases. can you please tell me the issue?

3 months ago

Thank you very much, everyone, for your help. I was able to fix the issue using arrays.sort. For this case number of input is 5.

So, this solution is ok I believe. Thanks again. My approach.

So, this solution is ok I believe. Thanks again. My approach.

3 months ago

problem: Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers.

Then print the respective minimum and maximum values as a single line of two space-separated long integers.

For example, arr=[1,3,5,7,9]. Our minimum sum is 1+3+5+7=16 and our maximum sum is 3+5+7+9=24. We would print 16 24

Issue: My output is wrong. I think I'm doing something wrong in my logic.

Can you please give a hint on that?

Then print the respective minimum and maximum values as a single line of two space-separated long integers.

For example, arr=[1,3,5,7,9]. Our minimum sum is 1+3+5+7=16 and our maximum sum is 3+5+7+9=24. We would print 16 24

Issue: My output is wrong. I think I'm doing something wrong in my logic.

Can you please give a hint on that?

3 months ago

Problem: Observe that its base and height are both equal to, and the image is drawn using # symbols and spaces. The last line is not preceded by any spaces.

Write a program that prints a staircase of size.

The output of the program should be like this for n=4.

#

##

###

####

My issue in this problem: The output(for n=4) is

#

##

###

####

can you please help me out? what I'm doing wrong in my code. Thanks. The code is given below.

Write a program that prints a staircase of size.

The output of the program should be like this for n=4.

#

##

###

####

My issue in this problem: The output(for n=4) is

#

##

###

####

can you please help me out? what I'm doing wrong in my code. Thanks. The code is given below.

3 months ago

Thank you very much. I was able to fix the issue.

3 months ago

Q. Given an array of integers, calculate the fractions of its elements that are positive, negative, and are zeros. Print the decimal value of each fraction on a new line.

The output has to be in 6 decimal points.

Problem: It's showing me compile time error. "Solution.java:38: error: cannot find symbol

System.out.println(df.format(result1));"

The problem is in the print of results. Can you please give me a hint on how to overcome this issue?

The output has to be in 6 decimal points.

Problem: It's showing me compile time error. "Solution.java:38: error: cannot find symbol

System.out.println(df.format(result1));"

The problem is in the print of results. Can you please give me a hint on how to overcome this issue?

3 months ago

Thank you very much. I was able to fix the issue.

3 months ago

Now the error is run time error. Exception in thread "main" java.lang.NullPointerException at Solution.main(Solution.java:82).

And I'm not sure about the return of arraylist. Is that correct? Can you please help me regarding this?

Thanks

And I'm not sure about the return of arraylist. Is that correct? Can you please help me regarding this?

Thanks

4 months ago

Thank you very much for your explanation and help. How can I return two values as an arraylist where I have counter1 and counter2 values?

I want to store it in arraylist and want to return that arraylist from Comparetriplets method.

I want to store it in arraylist and want to return that arraylist from Comparetriplets method.

4 months ago

Hi,

The compareTriplets function will compare between array list of a and b. Easch array list has 3 elements.

if a>b then score for a is increased by 1, else if a==b do nothing if a<b then score for b is increased by 1

Here, I want to return an array list of compareTriplets function which will have 2 integer values of a and b. Then use this array list in the main function.

I'm not able to return an ArrayList from the compareTriplets function. can you please give me a hint on that.

Thanks.

The compareTriplets function will compare between array list of a and b. Easch array list has 3 elements.

if a>b then score for a is increased by 1, else if a==b do nothing if a<b then score for b is increased by 1

Here, I want to return an array list of compareTriplets function which will have 2 integer values of a and b. Then use this array list in the main function.

I'm not able to return an ArrayList from the compareTriplets function. can you please give me a hint on that.

Thanks.

4 months ago