Тёмный
KA Education
KA Education
KA Education
Подписаться
Welcome to the official KA Education RU-vid Channel!

Here, you'll find videos that help you learn the skills, tricks, and techniques you need to ace your technical interviews!

Topics covered include data structures/algorithms, system design, best software development practices, and interview questions!


Want more?
Check out our website, where you can claim your FREE copy of our data structures crash course, see all our FULL-LENGTH courses, and even sign up for 1-1 tutoring!

kaeducation.com/
Комментарии
@europana7
@europana7 Месяц назад
Resiliency can already be done by AWS identical Lamda in multi regions and Elasticache. … and Azure prob has an equivalent.
@sudhakardhayalan8874
@sudhakardhayalan8874 Месяц назад
This solution is failing for the edge case that I've created - [3, 2, 3, 1, 1, 1] For this, provided solution returns undefined. Need slight improvement in condition to fix this. Below one is working fine. let majorityElement = function (nums) { const ht = {}; for (const num of nums) { ht[num] = ht[num] + 1 || 1; } const isNumsOfEvenLength = nums.length % 2 === 0; const median = Math.floor(nums.length / 2); for (const key in ht) { if (isNumsOfEvenLength && ht[key] >= median) { return key; } else if (!isNumsOfEvenLength && ht[key] > median) { return key; } } };
@sudhakardhayalan8874
@sudhakardhayalan8874 Месяц назад
Or you can simply use the below solution let majorityElement = function (nums) { const ht = {}; for (const num of nums) { ht[num] = ht[num] + 1 || 1; } const median = Math.ceil(nums.length / 2); for (const key in ht) { if (ht[key] >= median) { return key; } } }; console.log(majorityElement([3, 2, 3])); // 3 console.log(majorityElement([3, 2, 3, 1, 1, 1])); // 1
@Nimzo003
@Nimzo003 Месяц назад
Best system design video I've ever seen. I'd hire you on the spot.
@chronoel
@chronoel 3 месяца назад
is there a way to replace zookeeper? why not just store a record of ranges used in a db or redis cache. since the operation of generating a new range happens once in a while. specifically, when a new server is being initialized and another when the range of a server rans out and need to fetch a new one
@vandal144
@vandal144 3 месяца назад
GOAT tinyURL vid
@FlashFreelancers
@FlashFreelancers 4 месяца назад
How do we identify the same long url which got converted to tiny url already ? Since we are using counter each time it will get a new tiny url no ?
@deep8843
@deep8843 5 месяцев назад
Really helpful!
@Mr.Zeus11
@Mr.Zeus11 6 месяцев назад
var plusOne = (digits) => (BigInt(digits.join('')) + BigInt(1)).toString().split('');
@JeanNascimentosuissa
@JeanNascimentosuissa 6 месяцев назад
thanks man!
@nishantscollectibles
@nishantscollectibles 7 месяцев назад
By far the simplest and easiest solution that I've seen. Thanks!
@tenaciousbali
@tenaciousbali 7 месяцев назад
Comprehensive explanation and good pointers. Loved this!!!
@umeshhbhat
@umeshhbhat 7 месяцев назад
maine be yahi bataya tha
@brownbearnishant
@brownbearnishant 7 месяцев назад
do more videos brother
@michelmdf
@michelmdf 7 месяцев назад
Why not just rely on a database cluster to generate a sequencial numeric id , and just persist the id and the long url ? So when a request comes in, we convert from base62 to decimal and find the record in the db. What is wrong of this idea ?
@suvajitchakrabarty
@suvajitchakrabarty 7 месяцев назад
If in case anyone is interested, the O(1) space complexity requires some bit manipulation. Essentially if you XOR a number with itself, it returns zero, and if you XOR a number with zero, it returns the number itself. So if you had the following numbers in the list - 3, 3, 2, the XOR between 3 and 3 would return 0, and then XORing 0 with 2 would return 2. Hence if you did a XOR for all numbers in a list which contains 2 of each numbers except for the one number, then you'd get back the number which occurs once. The code is pretty straightforward since you only need to do a XOR for every number, and return the result. Code in Javascript - var singleNumber = function(nums) { let res = nums[0]; for (let i = 1; i<nums.length; i++) { res = res ^ nums[i]; } return res; };
@fannyzheng1077
@fannyzheng1077 8 месяцев назад
Thank you
@seeboonsoo
@seeboonsoo 8 месяцев назад
No one explain better than this guy!!
@DocOmally101
@DocOmally101 10 месяцев назад
Could you do more system design videos? This was super insightful and really well explained. Any of these would be so helpful to understand in your delivery and explanatory sttyle: Google Docs Twitter LeetCode API Rate Limiter BookMyShow Chat Application E-Commerce Portal Splitwise Vending Machine Google Autosuggest Uber Parking Lot Stock Exchange Logging System Authentication Service Either way, thanks for the video man!
@MayankMakwana-n4d
@MayankMakwana-n4d 10 месяцев назад
not even working
@9939364566
@9939364566 10 месяцев назад
Amazing way of explanation.... I watched many YT videos and they all confused me. You nailed it ✌️ Tysm
@vaibhav_cs
@vaibhav_cs 11 месяцев назад
Excellent approach and proper delivery of content !
@AnangPhatak
@AnangPhatak 11 месяцев назад
Please make more videos on systems design. The content here is presented succinctly with non-complex simple diagrams and licid explanation.
@chirut4327
@chirut4327 11 месяцев назад
base62 encoding can result in a string of any length. And we are not supposed to take first 7 chars to avoid collision. So that means we take what ever output we get from base64. This is what I want to hear from these videos, but believe me none of them emphasize on this. They just say blabla and use base62.
@boyangzheng269
@boyangzheng269 7 месяцев назад
We are not encoding the original URL because as u said it would result in a string of any length. Instead we are encoding the numbers (0 - 3.5 trillion) which would not exceed 7 chars because 62^7 > 3.5 trillion.
@ayushgupta7731
@ayushgupta7731 Год назад
great explaination.
@chetankagyan
@chetankagyan Год назад
We can improve it using Boyer-Moore Majority Voting Algorithm in constant space.
@rohitdeepati7742
@rohitdeepati7742 Год назад
Thanks bro
@BestURLShortenerBioPageQRCode
Thank you for sharing this much of information.👍👍
@agyemangchristopher5248
@agyemangchristopher5248 Год назад
please give further explanation
@rohinirenduchintala
@rohinirenduchintala Год назад
The best comprehensive tinyURL video for system design i've seen so far. Please make more!
@mohammedunais2494
@mohammedunais2494 Год назад
how will handle [1,9,0] this input??
@DK-ox7ze
@DK-ox7ze Год назад
If we add 10-15 bits at the end of counter number then it will increase the base62 output size and exceed the 7 character limit. So can you clarify how that addition of random string works?
@jinushaun
@jinushaun Год назад
TLDR: md5(“123”) vs md5(“123,xyz”) The original solution hashed the returned counter value, which is a simple increasing number. The resulting hash is then base62 encoded. The new solution takes the counter number and appends some extra characters at the end. This new string is then hashed and base62 encoded. In this way, the string sent into hash is not guessable. This works because the numeric portion is still guaranteed not to collide.
@DK-ox7ze
@DK-ox7ze Год назад
But in this new solution also, there is a chance of collision because we are hashing the counter+random_chars and limiting the hash to a short length.
@chirut4327
@chirut4327 11 месяцев назад
Even without appending extra digits, base62 does not guarantees 7 chars. That simply means, we are not confining ourselves to 7 chars. We probably need to tell the interviewer that we would get as small as possible hash but no guarantees. This is a possible tradeoff to avoid collision.
@caiocutrim3596
@caiocutrim3596 Год назад
space complexity is O(N)
@abhishekkeshri3974
@abhishekkeshri3974 Год назад
bool isPowerOfThree(int n) { if(n<=0)return false; if(n==1)return true; return (floor(log10(n)/log10(3))==log10(n)/log10(3)); } O(1)
@jsfortechies-zh3br
@jsfortechies-zh3br Год назад
Good work
@somebody-17546
@somebody-17546 Год назад
You must implement a solution with a linear runtime complexity and use only constant extra space.
@hamzasanwar
@hamzasanwar Год назад
Why base 62 not base 64
@abjbreal
@abjbreal 4 месяца назад
52 alphabets and 10 digits = 62 total characters
@mohamedelidrissi810
@mohamedelidrissi810 Год назад
For caching, will it be better to have some kind of background job that populates the cache with the most popular URLs from the database? Else if you're always adding a URL to the cache, then it's no longer just the popular URLs but all of them (or at least the capacity of the cache).
@RandomShowerThoughts
@RandomShowerThoughts Год назад
this was very good, clean and concise. Really like this video, especially the logic as to not pick sql
@BabeCrs
@BabeCrs Год назад
it asks it to be in O(1) space complexity. How would you adapt this for that
@garrettsapps2526
@garrettsapps2526 Год назад
Great video! But perhaps a simpler solution might look like this: var moveZeroes = function(nums) { for(let i = 0; i < nums.length; i++){ if(nums[i] === 0){ nums[nums.length - 1] = nums.splice(i,1) } } }; This will only require one loop. If anyone can see any issues with this solution at scale please let me know.
@wingdphoto
@wingdphoto Год назад
Follow up: Could you solve it without loops/recursion?
@vonderklaas
@vonderklaas Год назад
Hello, please continue your videos!
@Prod3t
@Prod3t Год назад
W coder 🤷🏼‍♂️
@talktovideos4349
@talktovideos4349 Год назад
Thanks a lot for making this video
@parkerhemming9388
@parkerhemming9388 Год назад
Couldn’t you just join the array together, wrapped in Number function, add 1, then return split
@lunaretic3
@lunaretic3 Год назад
I did that and it passed most cases, but when it came to a really long array of length >14 or 15, for some reason it changed the last 4 numbers in the array to zero instead of what they actually were.
@ryuaan
@ryuaan Год назад
Good explanation. Was 75% there w/ this one but needed some help
@yehsunkang5150
@yehsunkang5150 Год назад
Really easy to understand the recursive nature and also binary data structure!
@samankayhanian3888
@samankayhanian3888 Год назад
Good Job
@pineappleapplepens
@pineappleapplepens 2 года назад
damn this tutorial was optimal af
@kanyshaiosmonova2008
@kanyshaiosmonova2008 2 года назад
thank you!
@zarbioromulood8854
@zarbioromulood8854 2 года назад
Please get back!