Тёмный
No video :(

HackerRank | Problem Solving | Forming a magic square 

Anurag Patel
Подписаться 161
Просмотров 20 тыс.
50% 1

Step by step explanation of Forming a magic square problem on HackerRank
with code at the end
HackerRank profile: www.hackerrank...
LinkedIn: / anurag-patel-101

Опубликовано:

 

22 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@himanshuarora8305
@himanshuarora8305 2 года назад
Guy, You made my day. This explanation is brilliant
@anuragpatel2821
@anuragpatel2821 2 года назад
Thanks... Glad you liked the video😊
@bibekanandasahoo3497
@bibekanandasahoo3497 Год назад
Beautiful Explanation sir love u
@Quassar18
@Quassar18 9 месяцев назад
15 - 3 = 12, not 11
@ashishverma1382
@ashishverma1382 9 месяцев назад
good explanation
@afixithei.V
@afixithei.V 11 месяцев назад
I dont understand it. It may have been explained properly just that I'm not used to coding challenges
@TheJinxzed
@TheJinxzed 3 года назад
Very nice explanation 👍
@anuragpatel2821
@anuragpatel2821 3 года назад
Thanks
@akashbhandary3799
@akashbhandary3799 Год назад
Can you explain the code plz
@mr.anirbangoswami
@mr.anirbangoswami Год назад
this problem is too advanced for me :( can't understand the explanation, i'm sure the explanation is very good, it's just beyond me at this point.
@ashankhere
@ashankhere Год назад
There are only 8 unique magic squares of 3x3 form, and we are finding the absolute difference between these(all 8) and our given matrix and finally printing the minimum value out of it. Hope this helps 👍
@F4C31355
@F4C31355 Год назад
I don't understand explanation behind statement that odd element must be in the center. How he made that conclusion based on fact that "even+even=even, odd+even=odd, odd+odd=even" - how does it help to understand that in the middle must be odd number?
@chibuikeoffu
@chibuikeoffu Год назад
exactly i hope someone clarifies this?
@swasti6906
@swasti6906 Год назад
we want sum of all rows cols and diagonals t be odd tht is 15, and odd= even + odd+even or odd=odd+odd+even . if we use up one of four even numbers in the center we wont have sufficient even number combinations for rest rows cols and diags to make their sum odd
@B3Band
@B3Band Год назад
This is not a long explanation, but you'll have to "read more" because i use line breaks for clarity Let's look at the four possibilities of sums if the center value is even. I'll put the center value in CAPS. Remember that the sum MUST be 15 (odd) even + EVEN + even = even (ILLEGAL!) even + EVEN + odd = odd (Allowed) odd + EVEN + even = odd (Allowed) odd + EVEN + odd = even (ILLEGAL!) Therefore, the only way to make a valid magic square with an EVEN number in the center, is if the other two values are OPPOSITE (one even and one odd) This means that you have the same quantity of even and odd numbers. But if you use an even number in the center, you are left with 3 remaining even numbers (2 4 6 8 but you used one in the center already) and you are left with 5 odd numbers (1 3 5 7 9). Therefore, you CAN'T match up one even with one odd. You will eventually be forced to do odd + EVEN + odd (which is ILLEGAL!). Therefore, you can guarantee that there is an odd number in the center, as an even number would be impossible.
@mohitdeo3648
@mohitdeo3648 2 года назад
How are you judging that no 1 can not be in middle
@LucasLeow
@LucasLeow 2 года назад
If we consider 1 as center number - | - | - - | 1 | - - | - | - The next smaller number available is 2. If u place the number 2, anywhere along the empty space, the counterpart will have to be 13. This is not possible because the largest number is 9. eg: 2 | - | - - | 1 | - - | - | 13
@abhishekanand4735
@abhishekanand4735 9 месяцев назад
logic at 4:00 second is completely wrong
@user-tk6un6mw3p
@user-tk6un6mw3p 7 месяцев назад
i don't understand his pronunciation
@user-gg3wn2ic1e
@user-gg3wn2ic1e 6 месяцев назад
Y make a video if u r not using the video. I don’t understand sh@t if u just speaking.
Далее
The MAGIC Square Problem (Coding Interview Question)
7:24
5 Simple Steps for Solving Any Recursive Problem
21:03
Unlocking the secrets of Magic Square puzzles
11:21
Просмотров 32 тыс.
Magic Square Party Trick - Numberphile
3:58
Просмотров 472 тыс.
Magic Squares by Brian Hadley
53:31
Просмотров 114 тыс.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
10 Common Coding Interview Problems - Solved!
2:10:50
Просмотров 573 тыс.