Skip to main content
2 of 2
add solution
AsukaMinato
  • 10.4k
  • 1
  • 17
  • 44

Transpose and then Map

{{2, 1, 1}, {0, 1, 0}, {0, 0, 1}} // Transpose // 
 Map[If[MemberQ[#, 1] || MemberQ[#, -1], x, y] &]

Or

{{2, 1, 1}, {0, 1, 0}, {0, 0, 1}} // Transpose // 
 Map[If[ContainsAny[#, {1, -1}], x, y] &]
{y, x, x}
AsukaMinato
  • 10.4k
  • 1
  • 17
  • 44