Company: nexthop.ai

Difficulty: medium

Problem Statement

Conway Cubes Space is an infinite three-dimensional grid. Every integer coordinate (x, y, z) holds one cube, and each cube is either active ( # ) or inactive ( . ). All but a finite number of cubes are inactive. Two cubes are neighbours if their coordinates differ by at most 1 in each of x , y and z and they are not the same cube. Every cube therefore has exactly 26 neighbours. During a cycle , all cubes update simultaneously, each one deciding from the state its neighbours had before the cycle began: an active cube stays active if exactly 2 or exactly 3 of its 26 neighbours are active; otherwise it becomes inactive; an inactive cube becomes active if exactly 3 of its 26 neighbours are active; otherwise it stays inactive. You are given a two-dimensional starting slice: the state of the plane z = 0 . Every cube outside that slice - including every cube at z != 0 - starts inactive. The slice is only the starting region; cubes anywhere in the infinite grid may become active later. Run exa

More nexthop.ai OA questionsInterview experiences