first-non-repeating-character (Clojure solution)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Not a good idea to put `(frequencies s)` into that anonymous function. It will be executed again and again for each character of input string, until the first non-repeating character gets found. You should perform it only once - in let binding just before the call to filter.

TomasBrejla
Автор

I'm not sure if that solution is 100% correct because map are not ordered in clojure so it's not guaranteed that the map you pass into filter is correctly ordered. It could happen that \o would be the first unique char in that seq. Im not a clj pro, so let me know if im wrong.

Mordredur
Автор

If you start a blog I think it would be cool if you add an email subscription. As a bonus you can make early releases (unlisted video link) to the mailing list subscribers. I can be raw unedited video. Or maybe have a poll once in a while what topics to cover. Also it's a nice way to collect feedback before releasing the video.

eugenej.
Автор

> That wasnt even clojure's final form
The first video is not wasted for our java friends, reduce is part of java8. Thanks for the update. Where do you find these niche functions?

sadface
Автор

Ok ok but how about pushing it to the limit. What if we use fold from reducers (it supports concurrent processing) and transient array for non repeating characters (since we don't actually care how many times they repeat) and then bench it against best java case.

eugenej.
Автор

How about changing facial expression on every new thumbnail similar to how old Wolfenstein displayed damage. first-non-repeating-character (THE FINAL SOLUTION) :rage4:

eugenej.
Автор

The question would be more clear if it was posed as "the first unique character in a string". I tried to find the original question to satisfy myself that @NickWhite read it correctly but the codesignal web site won't let you see that question even if you sign up.

JamesPratt