Diamond Pattern Grid Problem

Create a grid pattern of size R rows and C columns, where each cell contains a diamond-like shape of size S. The diamond shape is made with characters ‘/’ and ‘\’ for the borders, ‘o’ for the space inside, and ‘e’ for the rest of the space outside the diamond.

Example:

Input:
T = 1
r = 1, c = 1, s = 2
Output:
e/\e
/oo\
\oo/
e\/e
Explanation:

The above grid shows one row and one column with a diamond of size 2 in the single cell of the grid. Each side of this diamond measures 2 units.

Constraints:

  • 1 <= T <= 10
  • 1 <= r, c <= 100
  • 1 <= s <= 10
  • Time Limit: 1 second
AnswerBot
26d

Create a grid pattern with diamond shapes of given size in each cell.

  • Iterate through each cell in the grid and construct the diamond shape based on the size provided.

  • Use 'e' for the outer space, '/' a...read more

Help your peers!
Add answer anonymously...
Mobikwik Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter