Michael Grünau

Ranch Hand
+ Follow
since Oct 30, 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 Michael Grünau

Well let me explain the task to you.

It is about implementing an Iterator which returns digit sequences as a String.
We need to implement an Instanz of Iterator which goes through all the possible digit sequences of the given password length with the following conditions.

1. Digit Sequence of same number 0000
2. Digit Sequence rising 1234
3. Digit Sequence falling 4321
4. All the rest

We don't have a list where we can iterate over...
7 hours ago
The Main Part of the Task is about working with Iterators so this should be implemented in a next() method.

Of course are there better options to check for the password but for this one the main point is that the next() call iterates over the values as described before.
8 hours ago
Appreciate the help!!
Your code above is basically a neat way to create the increasing rows, correct?

For the moment I will try to come up with a solution by myself and maybe get back if I am stuck!
Thanks again!
3 days ago
Yeah I had similar approach but it gets messy after a while as the passwordLength can change and so do the amount of calls I have.

Maybe I implement a variable which stands for each step and changes if the step is done and don't use overall calls.

Quick question about the task in general, I think this approach is very basic and I don't loose the feeling that I could change the complete approach to make it way more efficient in the first place.
Any good idea or maybe a suggestion that I can look into?
3 days ago
The overall goal is to create a custom Iterator which Iterates over different combinations of values from 0-9 to find a password.
Length of the password is given at the beginning.

The iterator should be implemented with the following conditions:
All examples are based on password length 4.

1. Start with repeating numbers (1111,2222,3333,...)

2. Continue with increasing rows (1234,2345,3456...)

3. Continue with decreasing rows (9876,8765,7654...)

4. End with all missing Numbers with the correct length.

My idea was that when I keep tracking of how often the next() method was called I can go to the next task.
For example. I know that for the first condition we call the next() method at most 9 times until we need to change to the second condition.

So the first 9 times my next() will return in a loop the repeating values (first call = 1111, second call = 2222, third call = 3333 etc.)

3 days ago

Hello Friends,

I noticed that my first post was very vague and bad explained so after working on the task for a little bit I came across an issue I need to some help with.
At the moment I am trying to create a custom Iterator for my Task and I need to modify my next method according to some requirements .

To my question, with my current approach I need to find a way to have an overview how often my Method was already called.
The next() method gets called multiple times and when it reaches a certain number of calls/ already gave out a certain value it should change to another form of output.

Quick example:
Iterator should first give out Numbers from 0-9 in the form of : 0000,1111,2222.... until we reach 9999 so about 9 times.

Afterwards I want to change the outcome to increasing rows in the form of: 1,2,3,4 / 2,3,4,5 etc.

My first approach was to initialize a variable at the beginning which keeps track of the calls like

But from my understanding, calls will always be reset to 0 when I call the method again for the next value?
So how can I keep track of the called/ returned values to let my program know what to do next?

Help will be highly appreciated!

3 days ago
My Main Methods calls the Class with the parameters as below.

in RgbColor I want to extend the Binary Value of 0b011 to 8-Bit so 0b011011.
1 week ago
I unfortunately I can't clear out the code that transforms it into numeric values.

Is there a way to access the Input data directly before it gets transformed?
Otherwise I have no idea how I can repeat the Binary Code under the consideration that it might include 011011 (0) that I cannot see when i transform the int to Binary...
1 week ago
Hello Friends,

the problem got a little bit more complicated.

The input of the variables are not normal ints they are written in binary Code for example: 0b011.
Now when I transform the Input to a String and work with my char array it only work with the value 3 not 0b011.

Is there an easy way how I can add the missing parts to the binary Code?
Tried to transform the int to binary with: Integer.toBinary but then I am loosing the first part and the 0 before the 11.

Advice will be appreciated!!1
1 week ago
I think i found a relatively easy solution.

So bascially I use my value and transform it in a String and afterward put it in a char array.

So now my numbers are contained in the char array, correct?
I can simply Loop through the array according to the number of digits I can use and add them to a String.
Afterwards we transform the String back to an int?
1 week ago
Stephan van Hulst: So I basically transform my Int to a String and repeat the String according to the number of times required?
                            Do I need to put each digit of the Int to a String so I can also cut the value into two parts if I need to split up due to the digit limit?

Junilu Lacar: Thats correct!
1 week ago
Hello Friends,

back at it again with a new question.

For a project I need to implement a method that adds parts of the value or the whole value to the end of the value.

For example I have my int 11 and want to add 3 digits to 11 from the same int like: 11111.
Second example 10 with 6 more digits: 10101010

So I always need to add the value I have at the end a certain amount of times.
Thought about making an array and entering the numbers but the result needs to be an int to.
I am not able to find a mathematical way at the moment which is smooth? Any ideas to help me out?

Thank you very much!!!
1 week ago
Thanks everyone for the help!

#Problem solved
1 week ago
Good Evening Friends,

I am working on some sorting tasks with lists and I was able to implement a solution but my solution takes too long.
Execution timed out after 5000ms....

Here are the details of the task:

- List with n+1 Elements

- Output should be like this

My approach was simply to create a new list, start from the tail and the head of the old list add each element in the new list and go next to tail+1 and head-1 until all elements are transferred.
As mentioned before, the program works but the approach takes to long.

Does anybody have a better idea to speed up the process?
2 weeks ago