Тёмный
No video :(

The MAGIC Square Problem (Coding Interview Question) 

FelixTechTips
Подписаться 10 тыс.
Просмотров 41 тыс.
50% 1

How to convert a given 3x3 matrix into a magic square. Learn how magic squares work and how many there are.
Problem source on hackerrank:
www.hackerrank...
This video is part of my coding interview questions series.

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

 

22 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 34   
@gogatorsfoster1
@gogatorsfoster1 3 года назад
I think for this problem it's necessary to write the code to find all of the possible magic squares rather than hard coding in one test example.
@FelixTechTips
@FelixTechTips 3 года назад
I would say that both solutions are valid. I just wanted to present an approach that gives some thinking to the math of the problem before coding. This approach often leads to more efficient algorithms. To have less hardcoding at the end, one could also calculate the other magic squares from one given magic square by writing functions that rotate and mirror the given one.
@cesarl.c.847
@cesarl.c.847 3 года назад
Hi... after to wiew this great tutorial... maybe to view other video can you to download Excel file to resolve Square Magic 3x3 and 5x5. To Find on RU-vid as: Creación Cuadrado Mágico lado impar - Creating Magic Square odd side. Grettings.
@thecarrotdude
@thecarrotdude 3 года назад
Thanks for explaining this! It was one of the better videos explaining how to solve this problem.
@olafschlammbeutel
@olafschlammbeutel 4 года назад
Love the sound of the keyboard sounds really expensive
@FelixTechTips
@FelixTechTips 4 года назад
Ill try to reduce it nexttime :D
@xFay69
@xFay69 4 года назад
Is someone itching the wall in the background sometimes? good video btw
@GiovanniNabil
@GiovanniNabil 26 дней назад
that's O(1) solution right there, nice
@afixithei.V
@afixithei.V 11 месяцев назад
Clearest explanation so far. Thanks
@alexandreabarbosa
@alexandreabarbosa 5 месяцев назад
Outstanding explanation! Thank you
@Roshan-xd5tl
@Roshan-xd5tl 2 года назад
That was a great explanation man. Thank you for your contribution. Cheers :)
@angaragangabhavyasri415
@angaragangabhavyasri415 22 дня назад
thanks sir good explanation
@gasparottogui
@gasparottogui Год назад
Great explanation, thanks for that!
@algoavenger
@algoavenger 2 дня назад
Sir, how we can conclude that sum of each row and diagonal always be 15?
@b9944236
@b9944236 8 месяцев назад
Thanks a lot !
@FelixTechTips
@FelixTechTips 8 месяцев назад
You're welcome :)
@rpiitkgpian
@rpiitkgpian Год назад
Great explanation. The math was really interesting.
@webdev4786
@webdev4786 2 года назад
great thinking, but how are we going to handle this once we have a 5x5 square or even more? shouldn't be a better way than defining all the possible magic squares and comparing them.
@quiped7719
@quiped7719 10 месяцев назад
there is no way to have a 5x5 square because in a magic cube numbers cant be repeated, thats why we have a 3x3 with 9 spaces for 1 to 9 numbers
@webdev4786
@webdev4786 10 месяцев назад
@@quiped7719 make scene, thank you 👍
@GiovanniNabil
@GiovanniNabil 26 дней назад
​@@quiped7719 it's possible to have 5x5 if you're not constrained by numbers from 1 to 9 only, that's for 5x5 and numbers 1 to 25, the magic constant should be 5 * ( 25+1)/2 = 65. and you will have to generate combinations and all magic squares like done in the video Imagine trying to do that in 45 min coding assessment while there's another problem waiting to be solved.
@akhil8086
@akhil8086 5 месяцев назад
wow amazing 😍 from India
@mirtanvirahmed3868
@mirtanvirahmed3868 3 года назад
Nice one!
@ksh94940
@ksh94940 Год назад
In the code, how can you get the length of p[i] (integer). please correct it. I am getting an error.
@aigerimsadir3574
@aigerimsadir3574 2 года назад
thank you!
@franzmustermann760
@franzmustermann760 2 года назад
thx I understand it now
@ArchitBatham
@ArchitBatham Год назад
thanks
@JossinJax
@JossinJax 3 года назад
Is "s" an array you're given?
@FelixTechTips
@FelixTechTips 3 года назад
yes, its a given 3x3 array
@TheKorkahn
@TheKorkahn 4 года назад
A little überladen but anyways gj, I like it
@GiovanniNabil
@GiovanniNabil 26 дней назад
what's überladen? does it relate to binladen ?
@roasterhubb
@roasterhubb Год назад
thanku sir
@fareshassan4242
@fareshassan4242 Год назад
from where did you get the number 15 ?
@joshuaetim3279
@joshuaetim3279 9 месяцев назад
en.wikipedia.org/wiki/Magic_square#Properties_of_magic_squares
Далее
Unlocking the secrets of Magic Square puzzles
11:21
Просмотров 32 тыс.
skibidi toilet zombie universe 40 ( New Virus)
03:06
Просмотров 1,9 млн
This is the best way to learn C++ for free
0:40
Просмотров 410 тыс.
Design your own Hashset | Coding Interview Question
6:11
Magic Square Tutorial
5:59
Просмотров 2,2 млн
MAGICK SQUARES AND SIGIL MAGICK and HOW TO USE THEM
18:21