2946. Matrix Similarity After Cyclic Shifts

  Рет қаралды 42

CodeVia

CodeVia

8 ай бұрын

2946. Matrix Similarity After Cyclic Shifts #leetcode #leetcodechallenge #hashmap #googleinterview #javainterviewquestions #amazoninterviewpreparation #microsoftinterview #arraylist #treemap
leetcode.com/problems/matrix-...
You are given a 0-indexed m x n integer matrix mat and an integer k. You have to cyclically right shift odd indexed rows k times and cyclically left shift even indexed rows k times.
Return true if the initial and final matrix are exactly the same and false otherwise.
Example 1:
Input: mat = [[1,2,1,2],[5,5,5,5],[6,3,6,3]], k = 2
Output: true
Explanation:
Initially, the matrix looks like the first figure.
Second figure represents the state of the matrix after one right and left cyclic shifts to even and odd indexed rows.
Third figure is the final state of the matrix after two cyclic shifts which is similar to the initial matrix.
Therefore, return true.

Пікірлер: 1
@bsrayat8200
@bsrayat8200 8 ай бұрын
Well explained!
Java Is Better Than Rust
42:14
ThePrimeTime
Рет қаралды 175 М.
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 15 МЛН
БАБУШКИН КОМПОТ В СОЛО
00:23
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 16 МЛН
Cool Items! New Gadgets, Smart Appliances 🌟 By 123 GO! House
00:18
123 GO! HOUSE
Рет қаралды 17 МЛН
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 10 МЛН
Leetcode 2946. Matrix Similarity After Cyclic Shifts
7:58
Elite Code
Рет қаралды 116
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 15 МЛН