Psedo code description of approach :
1. create new array of given array size
2. loop given array in for loop
3. check each element value not greater than 10
4. if yes multiply by 10
5 if no give same value from given array to new array

I wrote my code as below

public int[] tenRun(int[] nums) { int len =nums.length; int[] arr=new int[len]; for(int i=0;i<len;i++){ if(nums[i]<10){ arr[i]=nums[i]*10; } else{ arr[i]=nums[i]; } } return arr;}

CREATE, GREATER THAN, and MULTIPLY are not mentioned in the Challenge.
Work on the pseudo code, not the code.

How important is the pseudo code?
Do you realize you are actually failing all of the tests?
The only cases that pass are those where the input string is already in final form.

You can not improve your English comprehension by studying Java.
You might be able to improve your Java skills by slowing down and working on one question at a time.
But I've said that several times already and you don't seem to agree.

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

For each multiple of 10 in the given array, change all the values following it to be that multiple of 10, until encountering another multiple of 10. So {2, 10, 3, 4, 20, 5} yields {2, 10, 10, 10, 20, 20}.//however 3,4 became 10.10 i thought 5 should become 10
tenRun([2, 10, 3, 4, 20, 5]) → [2, 10, 10, 10, 20, 20]
tenRun([10, 1, 20, 2]) → [10, 10, 20, 20]
tenRun([10, 1, 9, 20]) → [10, 10, 10, 20]

tenRun([2, 10, 3, 4, 20, 5]) → [2, 10, 10, 10, 20, 20]
i thought above should be as below according to challenge description?
tenRun([2, 10, 3, 4, 20, 5]) → [2, 10, 10, 10, 20, 10]

What do you think the results of the following should be:
tenRun([2, 20, 3, 4, 10, 5]) → ???tenRun([2, 20, 10, 10, 10, 10])

>> However 3,4 became 10.10 i thought 5 should become 10
What multiple of 10 does the 5 follow???

What do you think the results of the following should be:
tenRun([2, 20, 3, 4, 10, 5]) → ???tenRun([2, 20, 10, 10, 10, 10])

No, that is not correct

For each multiple of 10 in the given array, change all the values following it to be that multiple of 10

Doing it by hand:tenRun([2, 20, 3, 4, 10, 5] 2 - no change 20 - multiple of 10 - no change 3 - change it 20 since it follows that multiple of 10 4 - change it 20 since it follows that multiple of 10 10 - multiple of 10 - no change 5 - change it 10 since it follows that multiple of 10

>> However 3,4 became 10.10 i thought 5 should become 10 What multiple of 10 does the 5 follow???//[b]not sure what it means..10*0 is 0 10*1 is 10 so 5 falls in between 0 and 5..when you say What multiple of 10 does the 5 follow i am not following it?[/b]What do you think the results of the following should be: tenRun([2, 20, 3, 4, 10, 5]) → ???tenRun([2, 20, 10, 10, 10, 10]) No, that is not correctFor each multiple of 10 in the given array, change all the values following it to be that multiple of 10Doing it by hand:tenRun([2, 20, 3, 4, 10, 5] 2 - no change 20 - multiple of 10 - no change 3 - change it 20 since it follows that multiple of 10 4 - change it 20 since it follows that multiple of 10 10 - multiple of 10 - no change 5 - change it 10 since it follows that multiple of 10//[b][i]but challenge expecting to change it to 20 not 10[/i][/b]

This is the case we are talking about now. It is one of the original test cases that you did not understand.
tenRun([2, 10, 3, 4, 20, 5]

>> However 3,4 became 10.10 i thought 5 should become 10
What multiple of 10 does the 5 follow???

>> not sure what it means..10*0 is 0 10*1 is 10 so 5 falls in between 0 and 5..when you say
What multiple of 10 does the 5 follow i am not following it?[/b]

falls between has nothing to do with following

multiple of does not mean multiply by

What multiple of 10 does the 5 follow in the array?
is the same as
What multiple of 10 comes before 5 in the array?

The answer in this case is 20. -- So change the 5 to 20.

This is the text of the Challenge, in case you have forgotten:
For each multiple of 10 (like 0, 10, 20, 30, ...) in the given array
change all the values following it (in the array) to be that multiple of 10 until encountering another multiple of 10.

Psedo code description of approach :
1. create new array of given array size
2. loop given array in for loop
3. check each element value modulus is 0(ie reminder)
4. if yes multiply subsequent elements by same previous element value?
5 if no give same value from given array to new array

i tried above approach. I have to print all values between firstval and secondval which i am not able to figure out how to proceed further esp if there is thirdval and fourthvale etc

Go through the array one element at a time.
Do nothing until you find a multiple of 10. You need a flag.
Once you find one you will use to replace later elements. Remember it.
The rest of the array elements are either replaced or used to update replacer.

Yes, you can combine the flag and the currVal variables for a more elegant solution.

You can come up with this sort of trick if you focus your thinking on algorithms and optimizations. You will never come up with them if you keep asking for basic help.

You are currently working on a problem that can use this exact trick. Good luck.

Look at rrz's code until you understand it. You may actually have to think about it.
That is the point.

How many problems are you currently working on?

0

Featured Post

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.

Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program.
Download Eclipse installation zip file:
Extract files from zip file:
Download and install JDK 8:
Open Eclipse and …

In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …