Share your repls and programming experiences

← Back to all posts
9
ReplProblemOfTheWeek #1 Staircases

These are 2 easy questions to get you started up!
Level A is the easier one and level B is a little harder.
Level A:
John the robot trying to climb up stairs following a certain command. He starts on the ground floor (floor 0) and then follows the instructions one character at a time.

An opening parenthesis, (, means he should go up one floor, and a closing parenthesis, ), means he should go down one floor.

Examples
((() => will get him on floor 2
))(( => will get him on floor 0
((((()) => will get him on floor 3

Where does John the robot end up with the instructions!
Input: https://repl.it/@IEATPYTHON/POTW?language=python3
The input is in the input txt file

Level B:
Now, given the same instructions(An opening parenthesis, (, means he should go up one floor, and a closing parenthesis, ), means he should go down one floor.), find the position of the first character that causes him to enter the basement (floor -1). The first character in the instructions has position 1, the second character has position 2, and so on.

For example:

) causes him to enter the basement at character position 1.
()()) causes him to enter the basement at character position 5.
What is the position of the character that causes John the robot to first enter the basement?

Input: https://repl.it/@IEATPYTHON/POTW?language=python3
The input is in the input txt file. It is the same input as problem A

Good luck to all on these questions!

2

The link to the input file is not working.

2

This looks very much like 2015's First Puzzle in Advent Of Code https://adventofcode.com/2015/day/1

2

This looks fun!

2

Good luck everyone!

1