Requirement:
"ADDED and REMOVED tags cannot be used consecutively - they must always be separated by the SAME tag."
QUESTION ONE:
Does this requirement mean that the following two conditions should met together?
1) The person who updated the file did never delete two or more lines at once, but for a maximum only one line, and left at least one line unchanged after the removed line.
2) The person who updated the file did never add two or more lines at the same time, but for a maximum only one line and left at least one line unchanged after the added line.
QUESTION TWO:
Looking at the attached picture, is my idea to the solution of the task correct?
Do I understand the requirements correctly?
Resolved
Comments (7)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
30 October 2021, 17:39
The image you included with this post was far more useful than the two example files they included in the conditions (basically "the files don't have any blank lines, but we added blank lines to the examples to make it more confusing"). Thank you for posting it.
0
Gellert Varga
1 November 2021, 22:10
"to make it more confusing" :-D
...Yes, unfortunately the requirements for some tasks are very unclear.
And when I'm really angry about things like that, I post these clarifying things/questions.
0
Gellert Varga
1 November 2021, 22:26
I wrote a program that can handle the 23 test cases shown in the picture below, as shown there.
I don't know if CodeGym's "correct solution" would work the same way.
I do know that my solution passed.
But it's possible that I just overinsured my solution unnecessarily, so it's possible that cases 1, 4, 6, 7, 8, 9, 10, 12, 14, 19 are not necessary to be able to handle by the program.
I really can't know it.
0
Guadalupe Gagnon
4 October 2021, 18:21solution
yes and yes. From your picture I am sure you have the correct idea, but just make sure that you understand that ADDED and/OR REMOVED cannot be used consecutively. So in the file there will not be any two lines that are:
ADDED, ADDED or
REMOVED, REMOVED or
ADDED, REMOVED or
REMOVED, ADDED
This helps keep the algorithm needed to solve this simple.
+2
Gellert Varga
4 October 2021, 18:37
Thank you! That's straight talk!:)
0
Justin Smith
30 October 2021, 17:40
Are you allowed to have two SAME lines in a row? The examples provided by CodeGym don't, but the image above does.
0
Guadalupe Gagnon
30 October 2021, 20:41
Yes. The only restriction is ADDED and/or REMOVED can't be against consecutive.
0