Leetcode - Transform to Chessboard (Python)

  Рет қаралды 1,063

Timothy H Chang

Timothy H Chang

Күн бұрын

Пікірлер: 4
@DrDYC
@DrDYC 8 ай бұрын
I ran into a counterexample of [[0,0,0],[0,0,1],[0,0,0]]. The code in the video outputs 2, but it should be -1. The chessboard cannot be made if either the two row patterns or the two column patterns are not complimentary to each other. To my knowledge, adding the following code between line 11 and line 12 can work: r_pat1, r_pat2 = cnt_r[0][0], cnt_r[1][0] c_pat1, c_pat2 = cnt_c[0][0], cnt_c[1][0] if not all(r_pat1[i]^r_pat2[i] for i in range(n)): return -1 if not all(c_pat1[i]^c_pat2[i] for i in range(n)): return -1
@errnil1988
@errnil1988 3 жыл бұрын
Hello Timothy ... i have been following your channel and also solved many problems with the help of your videos..could you please do videos related to Object Oriented Design Problems too..most of the videos you can find in youtube are in java ...try to do some videos for classic questions like parking lot , ticket booking system and meeting rooms
@svenvancrombrugge9073
@svenvancrombrugge9073 3 жыл бұрын
It's impressive how you can solve all those problems so easily. I did notice the mistake with the ">2" instead of ">1" right away while you typed it, but whenever I make such a mistake I would not be able to fix it without leaving the problem be for a while and revisit it at some later point. I'd never just find the thought error that actually is still active in my mind. How do you do that? Keep going and thank you for all the educational content!
@timc3406
@timc3406 3 жыл бұрын
Well it's easy to look smart when you've seen the answer already, I guess it's just practice, there are many times where I get stuck debugging and I have to step away too
Transformers (how LLMs work) explained visually | DL5
27:14
3Blue1Brown
Рет қаралды 3,8 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,4 МЛН
УДИВИЛ ВСЕХ СВОИМ УХОДОМ!😳 #shorts
00:49
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН
Lamborghini vs Smoke 😱
00:38
Topper Guild
Рет қаралды 37 МЛН
Longest String Chain - Leetcode 1048 - Python
15:34
NeetCodeIO
Рет қаралды 10 М.
LeetCode 782. Transform to Chessboard
30:10
Happy Coding
Рет қаралды 1,1 М.
So You've Been Rejected from FAANG
5:56
Timothy H Chang
Рет қаралды 9 М.
Alien Dictionary - Topological Sort - Leetcode 269 - Python
22:05
Асинхронный python / Python FastAPI / Python uv / Юрий Селиванов / #16
2:02:23
Организованное программирование | Кирилл Мокевнин
Рет қаралды 14 М.
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 8 М.
Delete and Earn - Dynamic Programming - Leetcode 740 - Python
19:09
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,4 МЛН