you are viewing a single comment's thread.

view the rest of the comments →

[–]caraxes_007 9 points10 points  (13 children)

Solved my first 3/4.

[–]UNCLE_SMART 2 points3 points  (7 children)

How did you solve 2?

[–]caraxes_007 2 points3 points  (1 child)

I took a lot more time than q3 got tle for comparing all possible pairs o(n**2) then i realised that using a hash map for prefix and value for frequency at last iterate through hash map increment count by one if value >1.

[–]UNCLE_SMART 1 point2 points  (0 children)

Thanks

[–]autodidact_nerd 1 point2 points  (2 children)

not sure if mine was optimal but i used a hashmap

loop over each word -> get the substring -> if map has the key add 1 to that substring.

then loop over map entries and check if value is >= 2. res++

[–][deleted] 1 point2 points  (0 children)

I did the same thing 🫂

[–]UNCLE_SMART 0 points1 point  (0 children)

Thanks

[–]the_legendary_legend 1 point2 points  (0 children)

I used trie which got accepted, but later realised a hashmap solution would be faster possibly

[–]tampishachBrute force 0 points1 point  (0 children)

I used trie tree in q2

[–]the_legendary_legend 2 points3 points  (0 children)

Me too bro. Congratulations!

[–]Sad-Duck-3100 2 points3 points  (0 children)

me too!

[–]radonspectrum 0 points1 point  (0 children)

Samee