Solving difficult challenges is a big part of our everyday life here at Klarna. Changing an industry doesn’t happen over a day and requires a lot of bright minds. Dive into one of the problems presented below and send us your solutions!

1. Choose one (or more) of the problems and solve it in whatever form you want, in your preferred programming language or by reasoning
2. Submit your solution(s) in an email to saga.edgren@klarna.com containing:
– Name
– University
– Field of studies and graduating year
– Solution(s) to the challenges

Be creative, be logical and have fun!

### Conway’s game of life

In this challenge you get to work on the fascinating Conway’s simulation game of life, which contrary to its name, is not a typical game… It falls under the category of cellular automata, and has been invented by the Mathematician John Horton Conway in 1970.

There are no rules on what you can deliver! You could provide the algorithm implementing the rules, or go further and find life patterns, other than the one provided here, that get to survive across generations. You may want to provide a visual representation of the evolution, or make an interactive game… It’s your engagement and the amount of fun when working on this that should define what to deliver.

The purpose of this game is to simulate life at the cellular level.

Presentation:

• The cells are depicted as square points in an orthogonal infinite grid;
• Each cell is neighboring with 8 adjacent cells;
• Each cell can be either “alive” or “dead”

The rules to the game are very simple, yet smart enough to ensure an unpredictable behaviour.

Rules:

1. Survival: An “alive” cell lives on to the next generation, when it had two or three “alive” neighbour cells.
2. Death: An “alive” cell will die, when it either has fewer than two “alive” neighbour cells, or when it has more than three “alive” neighbour cells.
3. Birth: A “dead” cell with exactly three “alive” neighbour cells is brought to life.

Evolution:

• The game starts with an initial pattern of “alive” cells, called a seed.
• During each generation all rules are applied simultaneously in every cell of the seed to identify the cells that will die or be born.

Suggested input:

• Start with a grid of 30 rows and 50 columns
• Observe how this initial seed gets to survive across generations:
• The seed is described by 10 cells as points in the grid with their x and y coordinates, {x,y}.
• 10-cell row: {{15,15}, {16,15}, {17,15}, {18,15}, {19,15}, {20,15}, {21,15}, {22,15}, {23,15}, {24,15}}

### Brain teasers

Dices – If you have a regular dice with six sides, how do you simulate a dice with 5 sides and how do you simulate one with 7 sides?

Playing cards – You are playing cards with a friend. There are six cards on the table before you numbered from 1 to 6. You will each draw one random card and the goal is to get the highest value possible. First you draw a card and get 2. Then your friend draws a card, looks at it and asks, “Do you want to change cards with me?”. Do you accept the change and in that case why?

How many rocks are there? – You and a friend have been caught by an evil wizard that like games. He has thrown you into two separate dungeons from where you can’t communicate with each other. In your dungeon there are eight rocks on the ground. In your friends dungeon there are twelve rocks on the ground. Each day the wizard comes and ask first you and then your friend if there are 18 or 20 rocks in total in both dungeons. If either of you replies incorrectly you will be stuck in the dungeons forever but you are allowed to pass and not answer at all. How long will it take you to get out and who will know the right answer?