178 - Grid Challenge | Greedy | Hackerrank Solution | Python

178 - Grid Challenge | Greedy | Hackerrank Solution | Python

Hackers Realm

2 года назад

9,673 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Артем Батьков
Артем Батьков - 16.09.2023 07:59

Thanks for the video
Actually, I did the same idea, but it doesn't pass all test. I am still debugging and have no idea what's going on. When it is obvious NO in the expected it must be YES and vice versa.
But your code is literally the same idea as mine

Ответить
Swastik Nath
Swastik Nath - 11.07.2023 11:57

Hackerrank intentionally makes the problem statement wrong to an easy problem hard.

Ответить
TrịnhHuỳnhThịnhKhang
TrịnhHuỳnhThịnhKhang - 05.06.2023 18:12

sir, I try it in another test case, this fail, I detect that .sort() didn't change the grid so I have to use grid[i] = sorted(grid[i])

Ответить
mAc Chaos
mAc Chaos - 26.09.2022 06:15

Your example was very helpful; I was beating my head against the wall for hours trying to figure out why my code wasn't working until I realized they described the problem wrong! It's supposed to be n x n grids, but it doesn't actually want that as the answer.

Ответить
Vyshak Kriss
Vyshak Kriss - 11.08.2022 16:21

Thanks

Ответить
AffiliateMonster
AffiliateMonster - 08.04.2022 02:49

The way I solved it doesn't require sorting the characters in every row. I just picked the minimum character of each row and checked if they are in ascending order. That is, I check the minimum of the first row with the next row's minimum character, and keep incrementing rows. I remove the minimum characters if they are less than the minimum of the next row. If not, I return "NO".

Ответить
Matthew King
Matthew King - 10.11.2021 22:38

Very helpful. Thank you

Ответить
Tularam Sa
Tularam Sa - 26.09.2021 14:22

awesome

Ответить