Flipping the Matrix : Solution to Hackerrank Challenge

  Рет қаралды 18,196

praveen

praveen

Күн бұрын

Пікірлер: 24
@monkeydog8681
@monkeydog8681 5 ай бұрын
I got this as a mock exam for day 2. 💀💀 Was given 24 mins to solve. Like wth.
@AkeemJonesajonesrock
@AkeemJonesajonesrock 2 жыл бұрын
awesome video and great use of excel to show a graphical representation.
@untitled6483
@untitled6483 5 ай бұрын
How did you reach this solution? I cannot even think about how to brute force it?
@seanclarke-1
@seanclarke-1 2 жыл бұрын
My only problem with this is the BIG assumption being made here. You're assuming that in all cases, you can get the maximum number to it's desired cell position. The game involves flipping entire columns and rows. This means that you could be displacing an already maximised cell to achieve the maximisation of another cell. I know that it must be possible, since the problem is too large otherwise, but is there a proof you could add to show that it is always possible to achieve the maximum colour value in the upper left quadrant by only flipping rows and columns?
@shabrishpraveen1
@shabrishpraveen1 2 жыл бұрын
Wow. I am happy someone asked me this This is exactly the question I had in my mind when I started. I wrote a brute force program and verified. Imagine a rubix. We will always be be able to bring the desired max value to specific cell.
@paladattadri7465
@paladattadri7465 2 жыл бұрын
@@shabrishpraveen1 really same doubt which i got like @Sean Clarke, i didn't understand why this much complicated task for basic mock test, i thought to leave the test. Thank for your explanation.
@kumaranil181
@kumaranil181 2 жыл бұрын
kzbin.info/www/bejne/Z5uqcqiqo62oj68 please check this for the extension where the example is also with 6*6 matrix and helps in imagining
@ktcoder
@ktcoder 2 жыл бұрын
@@shabrishpraveen1 Agree, in your example the flipping sequence will be C1 + R0 + C1
@karthiknaik7056
@karthiknaik7056 2 жыл бұрын
Good one and thanks Praveen! Liked the detailed explanations with examples. Hoping to see more such videos.
@shabrishpraveen1
@shabrishpraveen1 2 жыл бұрын
Thank you, Sure karthik :)
@missbluesky2512
@missbluesky2512 7 ай бұрын
Awesome video, thank you so much!
@helmetman216
@helmetman216 2 жыл бұрын
Great video Praveen, it is helping me a lot to understand. Keep up the good work
@trainguyen
@trainguyen Жыл бұрын
sir, your explaination so fantastc. thanksss
@himanshubakshi4176
@himanshubakshi4176 2 жыл бұрын
But 1 issue in this approach will be. When we are flipping the matrix for 2nd value, in that case the 1st value depending upon the row flipped will also change. Thus making the sum incorrect.
@yowpop3677
@yowpop3677 7 ай бұрын
thank you sir! i was able to understand the problem and how to solved it!
@arturtelezhkin632
@arturtelezhkin632 Жыл бұрын
Nice explanation. Thank you
@shabrishpraveen1
@shabrishpraveen1 Жыл бұрын
Glad it was helpful!
@LearnerH
@LearnerH Жыл бұрын
thank you sir maza aa gya.
@prabinbasnet4741
@prabinbasnet4741 2 жыл бұрын
Thank you!
@shabrishpraveen1
@shabrishpraveen1 Жыл бұрын
You're welcome!
@TheSilentLooters
@TheSilentLooters 8 ай бұрын
def flippingMatrix(matrix): n = len(matrix) // 2 total_sum = 0 for i in range(n): for j in range(n): total_sum += max(matrix[i][j], matrix[i][2 * n - 1 - j], matrix[2 * n - 1 - i][j], matrix[2 * n - 1 - i][2 * n - 1 - j]) return total_sum written in python3
@tadweber8140
@tadweber8140 Жыл бұрын
I need help with this, Im pretty sure my thought process was exactly yours.. ```int currentSum = matrix[i][j] + matrix[i][n-j-1] + matrix[m-i-1][j] + matrix[m-i-1][n-j-1];``` looping through every opposing value in the matrix but i keep coming up with 401 instead of 414...
@md.shafaatjamilrokon8587
@md.shafaatjamilrokon8587 Жыл бұрын
wow. genius
Flipping the Matrix | HackerRank | Solution Explained - Python
11:38
Tech and Navid
Рет қаралды 35 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Solución al reto Flipping the Matrix
10:24
May Code
Рет қаралды 1,4 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
Flipping The Matrix, Hackerrank problem
26:15
KUNDRA CLASSES
Рет қаралды 12 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 686 М.
Subarray division
33:17
TAP ACADEMY
Рет қаралды 3 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 781 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
How I Got Good at Coding Interviews
6:29
NeetCode
Рет қаралды 1,7 МЛН
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,3 МЛН
Zig Zag Sequence | HackerRank | Solution Explained - Python
8:15
Tech and Navid
Рет қаралды 10 М.