Square summer internship OA

I got the OA for Square for software engineer intern. What questions can I expect/how can I best prepare for it? Any tips would be appreciated.

Here are a few recent sample questions:

  1. Given an array of integers, change each element into the smallest value between the element itself and the two next to it.
  2. Given a matrix of integers,each entry represents a color, and a set of coordinates (array) called operations. For each coordinate in operation, check whether the 4 corner neighbors have the same color. If it reaches two then change that element and all its 4 corner neighbors to empty (0 value). Return the resulting matrix.
  3. Given an array of strings, calculate the largest number of pairs of strings where one string is the other’s suffix. If the two strings are equal that counts and each string has max 10 letters.
  4. Digit addition in this manner e.g. 10 + 19 = 29, 99 + 99 = 181
  5. Housing district with two input arrays. Array1’s elements tell you which indices has a house and array2 tells you whether the house at that index will be torn down. Return output that after tearing down the houses, how many housing segments are left (a row of houses).

Good luck, I hope this is helpful.

1 Like

Thanks a lot!

1 Like