Tripadvisor Phone Interview - Program to count all squares in matchstick grid
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-03-24Added By Anonymous
Source: Link
Question: First design a data structure to represent the below grid formed using match sticks. Using this data structure as an input write a program to count all the possible squares in the below example figures.
https://assets.leetcode.com/users/images/367905be-4909-44fc-97f8-e1cf67380f84_1616609094.673977.png
Answer: 16
https://assets.leetcode.com/users/images/bf9ebc0b-daae-4a43-805d-8d016a40a124_1616609111.1007457.gif
Answer: 2