Skip to main content
13 events
when toggle format what by license comment
Aug 27, 2024 at 11:51 vote accept Jill
Aug 27, 2024 at 11:05 comment added TorbenPutkonen I think we're straying a bit too far away from the purpose of this site as we're now teaching you how to implement the task instead of reviewing the code you've produced. You should next take the feedback we have provided, improve your code and once you have got it working, submit it for a new review. If you needhelp in implementing any of the ideas, you should consult stackoverflow.com .
Aug 26, 2024 at 16:26 comment added Jill Thanks @Torben , "Otherwise generate a new hash and check that the hash is free." --> what logic do you suggest to generate this new hash ?
Aug 26, 2024 at 11:47 history edited TorbenPutkonen CC BY-SA 4.0
added 7 characters in body
Aug 26, 2024 at 11:39 comment added TorbenPutkonen @Jill I have edited my answer with relevant information.
Aug 26, 2024 at 11:39 history edited TorbenPutkonen CC BY-SA 4.0
added 1145 characters in body
Aug 26, 2024 at 5:25 comment added Jill Regarding the logic to create hash , Is it optimal ?Kindly requesting a feedback if I am over-engineering the logic here ?
Aug 26, 2024 at 5:16 comment added Jill In that case will need to implement another concurrent hash map with key as short URL and value as long URL. Hope this will solve collision.
Aug 26, 2024 at 4:34 comment added TorbenPutkonen To detect collisions you will have to keep in storage each generated hash and the URL it was generated from. When you generate a hash you would first check if a stored hash exists for the URL and if it does, use it. Otherwise generate a new hash and check that the hash is free. If it is already used, you need to generate a new hash. The second point was a bit of a joke, but of course if this was a real product, it would be an issue. You should think about howto filter out "ugly" hashes. Adding special characters and numbers would help alleviate the problem.
Aug 25, 2024 at 13:08 comment added Jill Thanks for the detailed review Torben. 1.The hash generation does not take into account possible collisions.--> how can i avoid possible collision? what would you suggest ? 2. when we put this to production and the hashing method produces an extremely vulgar word, what are you going to tell the customer? --> Should I create it as mix of numbers and characters and special characters?
Aug 25, 2024 at 12:53 history edited TorbenPutkonen CC BY-SA 4.0
deleted 2 characters in body
Aug 25, 2024 at 12:44 history edited TorbenPutkonen CC BY-SA 4.0
added 186 characters in body
Aug 25, 2024 at 12:39 history answered TorbenPutkonen CC BY-SA 4.0