Company: Goldman Sachs_10july

Difficulty: medium

Problem Statement

Seating Arrangement Scatter Value Problem Description A classroom of fifteen students has one seat left empty, laid out as a 4x4 grid. Students are represented by the uppercase letters 'A' through 'O', and the empty seat is shown as a '.' (dot). The assigned arrangement is: A B C D E F G H I J K L M N O . Each morning the students file in and take whatever seat they like. The teacher then reseats everyone back into the assigned layout. Since this reshuffling happens every day, the teacher wants a way to measure how far a given morning's random seating strays from the assigned one, by computing a "scatter" value for it. Computing the scatter means finding, for each student and for the empty seat, the Manhattan distance between where they currently are and where they are assigned to be, then summing all of those distances. The Manhattan distance between seats at positions (r1, c1) and (r2, c2) equals |r1 - r2| + |c1 - c2|. Write a program that computes the scatter value for a given seati

More Goldman Sachs_10july OA questionsInterview experiences