Elixir and Erlang added to Leetcode

As far as I know, there hasn’t been any official announcement of this, but over the past week or so, Leetcode.com has been rolling out support for Elixir, Erlang, and Racket. At this point almost all of the popular questions accept Elixir solutions. A couple things I’ve noticed:

  • The editor needs some fixing in Elixir mode - the autoindentation seems especially broken, inserting tons of extra whitespace
  • For the linked list questions, custom ListNode structs are used, instead of standard Elixir Lists.

I’m wondering what others in the community think about this. Have you ever had to solve Leetcode problems for an interview? Do you think interviewers will start using Leetcode for Elixir positions?


Many questions that require mutation are extremely hard to solve in Erlang/Elixir (because in many cases you need to use some sort of a zipper).

Questions involving backtracking are very easy to implement in Erlang/Elixir due to immutability and the underlying optimization toward immutable data structures, but dynamic programming questions are usually harder to solve.

There’s no stack overflow in Erlang/Elixir, even for very deep body recursions.

1 Like

This is super cool!

Really cool to see more functional languages being used in such coding platforms. I think it’ll force me to think more about immutability, recursion, and pattern-matching. It’s a different kind a programming that what I do professionally. Before solving some of those coding challenges, I’ve never thought about recursively updating a struct at work like this :thinking:.

I already solved some easy questions, I really like to use and abuse pattern-matching for answering (here for example :smiling_imp:) but as @Aetherus mentioned, many questions still require mutability :man_shrugging:

Anyone has some good resources to recommend to learn data structures and algorithms with a functional programming language?

1 Like

I recommend trying Advent of Code with Elixir (or other FP language)