UTF - 8 Encoding Explained using Bit Manipulation | Bit Manipulation Interview Questions

  Рет қаралды 9,159

Pepcoding

Pepcoding

Күн бұрын

Пікірлер: 42
@sourin.majumdar
@sourin.majumdar 2 жыл бұрын
itni patience k sath samjhaya, Salute hai!! Crystal clear samajh aaya Ek aur testcase batana chahunga. If given array is [255], tab uski binary representation ho jaayegi 11111111. But uska check toh lagaya hi nhi, sidhe false return karna hai. So 3rd else if k baad ek 'else return false' lag jaayega bass kaam khatam
@prajyotgurav
@prajyotgurav 2 жыл бұрын
I couldn't understand today's Leetcode #393 question. Thanks to your video. I was able to understand and solve the question. 🙌🙌🙌
@adityarao8803
@adityarao8803 2 жыл бұрын
Awesome Explanation Sir. I was pretty confused looking and referring to other videos your video was very precise and easy to understand.
@ritikmishra5210
@ritikmishra5210 3 жыл бұрын
Those facing issue in leetcode submission, just add this condition in first if if(rbytes==0) { if ... else if ... . . *else return false* }
@Pepcoding
@Pepcoding 3 жыл бұрын
Visit nados.pepcoding.com and sign up to NADOS, for better experience and precisely arranged content. Don't forget to follow us on Instagram instagram.com/pepcoding/ Happy Coding!
@Shivanai_h
@Shivanai_h 2 жыл бұрын
Thank u ritik😀
@atulkumarverma2042
@atulkumarverma2042 2 жыл бұрын
I was here to comment the same 😇
@akhilesh59
@akhilesh59 2 жыл бұрын
Very Nice Explanation. Thanks a lot Sir
@creativegiant148
@creativegiant148 3 жыл бұрын
Sir kuch case reh gaye hain solution me jaise ki agr pehla number hii 10 se start hoga toh program handle nahi kr paye ga usse Btw rest is great!!
@mickyman753
@mickyman753 3 жыл бұрын
i found the checking logic for remaining bytes in loop beautiful ,sumeet sir great as always
@shubhamrawat7895
@shubhamrawat7895 4 жыл бұрын
Wao.. Great logic! I was thinking to use if else for every checking.. Using remainingbytes variable is nice 🔥😮
@Pepcoding
@Pepcoding 4 жыл бұрын
Je baat. Mza-mev-jayte. Mze ke hmesha vijay hoti hai. jo fun aa rha ho to ek review daal do yar g.page/Pepcoding/review?rc
@rahulbhatia3075
@rahulbhatia3075 4 жыл бұрын
Next level explaination 🙏🙏
@Pepcoding
@Pepcoding 4 жыл бұрын
Keep watching!! Share as much as you can
@rahulbhatia3075
@rahulbhatia3075 4 жыл бұрын
Sir pls make video on segment a nd Fenwick trees pls
@pariveshmehta2298
@pariveshmehta2298 3 жыл бұрын
sir isme aapne ek case consider nahi kiya jisme koi bhi condition satisfy na ho. for example [255] but thanks for the awsome eplaination.🤗
@prernnajain1532
@prernnajain1532 2 жыл бұрын
In that case we need to return false na
@balaveeraraghavareddy9764
@balaveeraraghavareddy9764 4 жыл бұрын
Thanks a lot very nice explanation
@pjagannadham2540
@pjagannadham2540 2 жыл бұрын
good explanation sir
@pareshshikhaliya4702
@pareshshikhaliya4702 3 жыл бұрын
best explanation
@shwetanksingh5438
@shwetanksingh5438 2 жыл бұрын
Thank You!
@ankitmindewar3710
@ankitmindewar3710 4 жыл бұрын
sir, video portal par play nhi ho rhi hai.
@Pepcoding
@Pepcoding 4 жыл бұрын
beta will look into that
@umanggupta9199
@umanggupta9199 4 жыл бұрын
Sir I think the code doesn't handle one case in which one element starts with 110 and next two or more elements start with 10. For that you need to add an else return false in first if case.
@glorysingh
@glorysingh 2 жыл бұрын
Yes I noticed the same bug.
@aashishjha3223
@aashishjha3223 4 жыл бұрын
Sir, it's not submitting in leetcode. If we put else if(val >> 7) != 0 return false in last in else if then it's submitting. testcase - [255]
@Elon-musk-007
@Elon-musk-007 4 жыл бұрын
it is because if there is anything else apart from these 4 conditions than it will always return false
@LegitGamer2345
@LegitGamer2345 3 жыл бұрын
@@Elon-musk-007 will always return true
@AmanRaj-nn6xx
@AmanRaj-nn6xx 3 жыл бұрын
modify the code by adding false condition like this(If you still have the doubt and you survived the pandemic):- if(rembit == 0){ if( (val >> 7) == 0 ){ rembit = 0; } else if( (val >> 5) == 6){ rembit = 1; } else if( (val >> 4) == 14){ rembit = 2; } else if( (val >> 3) == 30){ rembit = 3; } else{ return false; }
@satyajeetrajupali3147
@satyajeetrajupali3147 9 ай бұрын
Correct Solution: int rbytes = 0; for(int num: data) { if(rbytes == 0){ if((num >> 3) == 0b11110) rbytes = 3; else if ((num >> 4) == 0b1110) rbytes = 2; else if ((num >> 5) == 0b110) rbytes = 1; else if ((num >> 7) == 0b0) rbytes = 0; else return false; } else { if ((num >> 6) != 0b10){ return false; } rbytes--; } } return rbytes == 0;
@amandixit3555
@amandixit3555 4 жыл бұрын
sir aap agar formal shirt mei vedio bano ge to jyada viwes aayenge , give it a try !!!
@Pepcoding
@Pepcoding 4 жыл бұрын
Yeah, bhot din ho gae. Kal se try karta hun. Shayad nha ke bnaun aur shave regular karoon to bhi fayda hoga. I agree, a teacher must look presentable.
@code7434
@code7434 4 жыл бұрын
Sir binary search ke partitions of array ke que ki variations krwado please :)
@Pepcoding
@Pepcoding 4 жыл бұрын
it's there in array section
@code7434
@code7434 4 жыл бұрын
@@Pepcoding can u share the link , I m asking for problems like painter partition using binary search and its similar variations :).
@NishantKumar-hu7dq
@NishantKumar-hu7dq 3 жыл бұрын
We need to handel one more case when rbytes==0 In else part for these type of input 197 130 8 130
@sanjaymajhi7861
@sanjaymajhi7861 3 жыл бұрын
sir, as per what u said in first video, that if there are 8 bits , then 7 bits represent the number and 1 bit for sign, then why this thing is not there in this question. I am confused at this point. Thank you
@shivanishree276
@shivanishree276 2 жыл бұрын
sir can you please explain in English
@orien1116
@orien1116 2 жыл бұрын
sir what if [255] ?this shouldn't be the else condition when remainingByes == 0!?
@sailendrachettri8521
@sailendrachettri8521 2 жыл бұрын
add else int the else if statement class Solution { public: bool validUtf8(vector& data) { int remBytes = 0; for(auto val : data) { if(remBytes == 0) { if( (val >> 7) == 0b0 ) remBytes = 0; else if( (val >> 5) == 0b110) remBytes = 1; else if( (val >> 4) == 0b1110) remBytes = 2; else if( (val >> 3) == 0b11110) remBytes = 3; else return false; } else { if( (val >> 6) == 0b10) remBytes--; else return false; } } if(remBytes == 0) return true; return false; } };
@JitendraKumar-ti6yd
@JitendraKumar-ti6yd 2 жыл бұрын
Leetcode solutions: public boolean validUtf8(int[] data) { int remBytes = 0; for(int var : data) { if(remBytes == 0) { if((var >> 7) == 0b0) { // 1byte remBytes = 0; } else if((var >> 5) == 0b110) { // 2 byte remBytes = 1; } else if ((var >> 4) == 0b1110) { // 3 byte remBytes = 2; } else if((var >> 3) == 0b11110) { // 4byete remBytes = 3; } else { return false; } } else { if((var >> 6) == 0b10) { remBytes--; } else { return false; } } } if(remBytes == 0) { return true; } else { return false; } }
@sujitwalmiki3603
@sujitwalmiki3603 2 жыл бұрын
Underrated content🥲
Minimum XOR Pairs | Min XOR Value | Bit Manipulation
17:19
Pepcoding
Рет қаралды 20 М.
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 28 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
Easy Google Coding Interview With Ben Awad
28:00
Clément Mihailescu
Рет қаралды 1 МЛН
Solve Sudoku using Bit Manipulation | Sudoku Solver in JAVA
13:57
He's worth INR 50 crore. But still lives on Rent | The Tenant |
19:34
Я купил Lada Aura
41:40
Клубный сервис
Рет қаралды 334 М.
Top 7 Data Structures for Interviews Explained SIMPLY
13:02
Codebagel
Рет қаралды 236 М.