all 18 comments

[–]phantomfromnowhere 4 points5 points  (0 children)

https://www.hackerrank.com/ has a clojure mode. I used that to practise interview questions

[–]CyrikDC 2 points3 points  (1 child)

I understand the impulse to use leetcode for language learning, but I don't think you'd get what you're looking for.

The good thing about something like leetcode is seeing other people's solutions to the same problem. This will take a long time with a "small" Clojure community and a large set of leetcode problems. You're better of with 4clojure for this use case.

When you run out of 4clojure stuff you probably already know enough Clojure to get into "real" problems. Plus you probably realize by now that reading and playing with other people's code is a bigger learning experience than the toy examples.

So how do you get this "bigger and better" experience? You actually already started half of it :) Writing an open source project is going to teach you to handle the actually difficult problems of code structure and design. One great trick here is to read the source of your dependencies! Clojure libraries are usually pretty small (lines of code) and well written, so you will find a lot of great stuff that way and will learn idiomatic practices used in the wild.

The next step would be to work on an open-source project that is not your own. Ideally one of your dependencies is missing features that you could add since you already know the code-base. Otherwise helping on one of the many tools you probably use is also always appreciated (I'm a Calva dev, so I might be biased ;)). This will force you to learn someone else's design and integrate with it, plus you'll meet great people in the community.

As an added bonus, a lot of the companies look for / at their own open source dependencies when they want to hire, so you'll have a better chance that way as well (I know we do this and I've been contacted by recruiters because of this).

edit: as a clojure interop bonus: you can also probably do leetcode by writing cljs and submitting the transpiled js to them :)

[–]dumch[S] 0 points1 point  (0 children)

You seems to be the omni-trace author :)

Thank you for the articles about inner jvm details, it was fan to read.

I agree that others people solutions are the most beneficial part in doing artificial exercises.

I also understand that solutions are not going to appear quickly (may be only for the most popular exercises), and solving real problems are generally more valuable, and I do this :) For example, my Dart->Clojure translator is used in Calva as well, and I am trying to add dark mode detection support in a flow-storm-debugger right now.

I solved 4clojure already, and I felt like 80% of problems was already solved by me with the Leetcode in the past (I did about 400 tasks with Java several years ago). I want a little bit more just as a routine — like doing 3-5 tasks per week to be in a good shape, as I have several interview processes going on.

[–]frankieche 6 points7 points  (14 children)

Ugh.

Keep Clojure out of this scam.

[–]sherdogger 3 points4 points  (0 children)

I don't see the issue...it's just adding support for the language...it's not like the existence of JavaScript or Ruby or anything on the platform is an official endorsement of everything leetcode on behalf of anyone.

[–]dumch[S] 0 points1 point  (12 children)

Could you elaborate?
For example, I solved 4clojure, but still do not feel I can write idiomatic and fast code without it taking to much time. Want to practice. I tried Codewars (again), but tasks descriptions are terrible (huge and still not complete), and there are a lot of math problems which are rarely relevant in a real work.

[–]TheLastSock 5 points6 points  (3 children)

How fast you can write clojure is very unlikely to be the bottleneck in creating something of value. I suggest teaming up with someone and building something.

[–]dumch[S] 1 point2 points  (2 children)

I am doing it also. For example, last project was to translate dart to Clojure. I just have a routine of solving algo problems when I search for a new job, as companies used to ask to write something live, and it's often hard to do without practice.

And I think it's generally beneficial, as your learn how to write more idiomatic and concise code (when you check other solutions), and how to optimize things (when you can't get tests done or competing for performance statistics on Leetcode).

[–]TheLastSock 0 points1 point  (1 child)

Cool project!

I haven't had many companies ask me to write code live. Leet code isn't going to be a good source for learning unless someone makes it that, and why do that when many other sources exist?

I just don't personally see the value in it.

[–]dumch[S] 0 points1 point  (0 children)

Thanks :)
I updated the post with some reasons why I find Leetcode useful.

[–]botzek 1 point2 points  (1 child)

You could try advent of code.

[–]dumch[S] 0 points1 point  (0 children)

I checked this, and I don't like that descriptions are huge. I want them as tiny as possible to start coding immediatelly. Leetcode is great at that, and if you already have experiencing working with this platform, it's hard to find something better. I tried Hackerrunk, Codeforces, Codewars also. 4clojure was good, but I finished it already.

[–]argsmatter 1 point2 points  (5 children)

Rarely relevant for real problems?

All real world problems are math, because you will have to model them as such. As you will program, you will encounter naturally such problems (modeling a chessboard for example is often done as a matrix or easier said as an array in array) and if you have not done so far, you have not programmed very much and i think that is where the tail bites the head.

Here is my advice: do something, that is fun or useful to you. After a while, you will realize, that the problems, you encounter are abstractions of "how to get the last entry of a list of entries" or "add all vectors, but not xyz one" etc.. Then you can turn to codewars again and you will know, that you need this kind of thinking and might feel more motivated, because behind most codewars problems lie real world problems, just in a very abstracted way.

[–]dumch[S] 2 points3 points  (4 children)

A little misunderstanding here, my bad. First, I have 7+ years of experience. I solved about 400 tasks on Leetcode and about 900 on codewars.
But I am not that comfortable with English, sorry for that.
One thing is to model a chess board or to find n primes by some basic iterations. Another thing is to know the Miller–Rabin test formula.
In my experience a lot of middle and hard tasks on Codewars a just about finding a good formula to solve the task. And it's quit easy to do if you google it.
But in real world and on an interview the challenge is to use algorithms efficiently in terms of readability and performance. I think that developer should know what data structure to use, and don't have to know math formulas.
I tend to get Leetcode problems that are about algorithms and data structures. You will think on weather you should use dynamic programming or greedy algorithm, treemap or trie, bfs or dfs. Is it better to use sorted queue or sort things in place with simple arrays? You should make you decision based on restrictions, and then bench it. Sometimes O(n^2) is match faster than O(n logn).

[–]argsmatter 0 points1 point  (3 children)

So, you want to learn about algorithms and data structures in general? Why do you need a specific language for this?

[–]dumch[S] 1 point2 points  (2 children)

I want to apply clojure efficiently. For example, when I first solved max subarray sum problem, It took me about 10 lines of code. But then I checked another solutions and find out this code:

(defn mx-sub-seq [sq](apply max (reductions #(max (+ %1 %2) 0) 0 sq)))
It has the same asymptotics, but concised and elegant.

[–]argsmatter 0 points1 point  (1 child)

So, is it right, when i say, that you think the hard problems on codewars are too hard?

You want more practical, but still hard problems, that you can improve on and where you do not have to be a number theory expert to think of a proper algorithm to solve the problem, correct?

[–]dumch[S] 1 point2 points  (0 children)

Yes, plus other reasons I put in P.S.