Let's create a SnakeNLadder.java class. Define constant WINPOINT with value 100. Each player has to start the journey from 0, roll the dice and try to reach WINPOINT.
Showing posts with label System Design. Show all posts
Showing posts with label System Design. Show all posts
June 18, 2020
July 16, 2019
All About Bloom Filter
What is Bloom Filter?
Bloom filters are for set membership which determines whether an element is present in a set or not. Bloom filter is a probabilistic data structure that works on hash-coding methods (similar to HashTable).
It is a memory-efficient, probabilistic data structure that we can use to answer the question of whether or not a given element is in a set.
System Design Interview: Consistent Hashing
What is Hashing?
Hashing is the process of mapping one piece of data to another piece of data of fixed size. A function is usually used for mapping objects to hash code (which is typically an integer) known as a hash function.
Let's say we have fixed buckets numbered from 0-N. We have X number of balls (which is typically greater than or equal to N), and now we want to distribute these balls in the different buckets.
Hashing is the process of mapping one piece of data to another piece of data of fixed size. A function is usually used for mapping objects to hash code (which is typically an integer) known as a hash function.
Let's say we have fixed buckets numbered from 0-N. We have X number of balls (which is typically greater than or equal to N), and now we want to distribute these balls in the different buckets.
July 14, 2017
System Design Interview: How to implement TinyURL?
TinyURL shortens the long URL. URL shortening will have below benefits:
- Save space when displayed, printed or messaged.
- Consume less space when tweeted.
- Users are less likely to mistype the shorter URL's.
Why that's the wrong answer? because the person who is taking the interview us not looking for a simple solution where you take a longer url and convert it into a shorter one, store it in a map and returning the long url from the map whenever required.
The interviewer is interested ti test your knowledge on durability and scalability. The above diagram is correct, but sadly its neither durable nor scalable.
Subscribe to:
Posts (Atom)
