0422. Valid Word Square

https://leetcode.com/problems/valid-word-square

Description

Given an array of strings words, return true if it forms a valid word square.

A sequence of strings forms a valid word square if the kth row and column read the same string, where 0 <= k < max(numRows, numColumns).

Example 1:

Example 2:

Example 3:

Constraints:

  • 1 <= words.length <= 500

  • 1 <= words[i].length <= 500

  • words[i] consists of only lowercase English letters.

ac

read carefully

Last updated

Was this helpful?