Share your repls and programming experiences

← Back to all posts
9
ReplProblemOfTheWeek #2 Sunflowers

Congrats to everyone who participated in POTW 001 Staircases. We saw some amazing solutions there! The answer to level A was 74 and for level B was 1795. We had a total of 10 responses and all 10 were correct.

*Featured Answers:
1. https://repl.it/@pyelias/RPOTW-1 @Pyelias answer version in python! It was nice and simple. He was also the first to answer!
2. https://repl.it/@MeeksFigurski/exampleanswer @MeeksFigurski answer in Regex! Majority of the answers were in python but MeeksFigurski stepped it up by also using regex!

Great job to everyone who participated in last weeks POTW.


This weeks POTW has only one level! It is not too hard but also not too easy. Here it is:

Problem Description
John grows sunflowers. Depending on how many different types of sunflowers there are in a group the size of the group will differ. Lets say there are 2 different types of sunflowers in a group. Then there will be a 2X2 grid of flowers. If there are 3 then there will be a 3X3 grid of different flowers. All the flowers are on a rotating mechanism for each different type of sunflower there the machine will rotate 90 degrees. Make a program that will find the end placement of the sunflowers for any possibility of how many types of sunflowers there are and the inputs of there placement and height.

*ROTATIONS ARE ALWAYS 90 DEGREES**
Sample Input 1
2 How many types of sunflowers
1 3 => There heights
2 9 => There heights
Output for Sample Input 1
9 2
3 1
Explanation of Output for Sample Input 1
The data has been rotated rotated twice clockwise
Sample Input 2
3
4 3 1
6 5 2
9 7 3
Output for Sample Input 2
1 2 3
3 5 7
4 6 9
Explanation of Output for Sample Input 2
The original data was rotated 3 times clockwise

Sample Input 3
3
3 7 9
2 5 6
1 3 4
Output for Sample Input 3

9 6 4
7 5 3
3 2 1

Explanation of Output for Sample Input 3
The original data was rotated 3 times

Sample input 4:
5
1 2 3 4 5
2 3 4 5 6
4 5 3 2 4
3 2 1 2 3
1 3 4 5 6

Output for sample input 4:

1 3 4 2 1
3 2 5 3 2
4 1 3 4 3
5 2 2 5 4
6 3 4 6 5

Explanation. The original configuration was rotated 5 times of 90 degrees or also just being rotate once.

Make sure to post your answers on the answer post right here => https://repl.it/talk/share/ANSWERS-POTW-002/9200
Also please don't ask for spoon feeding in the comments

Good luck to everyone who is participating! In this challenge!

Loading Repl
Commentshotnewtop
2

I want to make sure I'm reading this right:
John has planted sunflowers in an N by N grid. The first line of input is an integer N, where N > 0.
The next N lines of input form a grid of the integer heights of the sunflowers, where each height is greater than zero, and they do not grow or shrink over the course of the problem. John rotates the grid N times, and each time he turns it 90 degrees clockwise. The answer is a grid of the heights after all the rotations.

That's the impression I get from the examples. Is it correct?

2

@DrankArizonaIce Yes! Great! That means that example 4 is a little wonky. I see it as:

Sample input 4:
5
1 2 3 4 5
2 3 4 5 6
4 5 3 2 4
3 2 1 2 3
1 3 4 5 6

Output for sample input 4:

1 3 4 2 1
3 2 5 3 2
4 1 3 2 5 4  <== Where this line is wrong
5 2 2 5 4
6 3 4 6 5

When I think it should be

Sample input 4:
5
1 2 3 4 5
2 3 4 5 6
4 5 3 2 4
3 2 1 2 3
1 3 4 5 6

Output for sample input 4:

1 3 4 2 1
3 2 5 3 2
4 1 3 4 3  <== With this as the corrected line
5 2 2 5 4
6 3 4 6 5

Does that make sense?

1

@EricAndow Yeah it seems he's made a small typo. I'm sure it'll be fixed soon.

1

This seems like fun!

1

@IEATPYTHON I thought theangryepicbanana was doing it this time

1

@fullern000 He did not have enough time. So I just did it. He will do it next week