Pattern

Simulation

A compact view of archive entries grouped by recurring technique.

98 entries

98 entries tagged as Simulation.

10.05.2023

medium

59. Spiral Matrix II

to detect an empty cell, we can check it for == 0

Array is used to represent the matrix and store results. Iterative traversal of the matrix is used to fill the spiral pattern. Simulating a robot moving in a spiral pattern to fill the matrix. Checking boundaries and visited status before moving to the next cell. The problem involves generating a spiral matrix. Using 2D arrays to represent the matrix.

8.11.2022

easy

Make The String Great

The simplest solution is just to simulate all the process, as input string is just 100 symbols.

char array (toCharArray) string manipulation nested loops for pairwise comparison iterative process to resolve conflicts checking adjacent/non-adjacent characters for equality and difference string processing