Problem Β· Matrix
Replacing Val π
Learn this problemProblem statement
Sup π!
This time the agency will give you:
What they want you to do:
Replace the val at the starting position with the provided replacing val. Repeat this process for all positions connected to the starting position via sides with the same val as the starting position.
Function
replacingNum(replacingVal: int, arr: int[][], pos: int[]) β int[][]Examples
Example 1
replacingVal = 2arr = [[0, 1, 0, 0, 0], [1, 1, 1, 0, 0], [1, 1, 0, 0, 0], [0, 1, 0, 1, 0]]pos = [1, 2]return = [[0, 2, 0, 0, 0], [2, 2, 2, 0, 0], [2, 2, 0, 0, 0], [0, 2, 0, 1, 0]]No explanation is provided for now.
For original prompt, pls refer source image.
Constraints
Unknown for now π€²More Two Sigma problems
- Balanced Split String with WildcardsOA Β· Seen Jul 2026
- Closest ColorOA Β· Seen Jul 2026
- Linear InterpolatorOA Β· Seen Jun 2026
- Online No-Intercept Linear RegressionOA Β· Seen Jun 2026
- Piecewise Linear Interpolation and ExtrapolationOA Β· Seen May 2026
- Sewer Drainage PartitionOA Β· Seen Mar 2026
- Calculate y/x using PatchOA Β· Seen Nov 2025
- Nums That Are Divisible by N πSeen Mar 2024