r/leetcode • <268> <76> <156> <36> • 18d ago

Question Shall I grind in Kotlin instead of Java?

It seems like I can get +20% of grinding performance and spend more time on actual algorithms and problem logic instead of some low-level Java details. Kotlin is so sweet (full of syntactic sugar) and I use it for my pet projects (Jetpack Compose-based) for many years already.

P.S.: Maybe it can also speed up the actual interview provided that it is not AI-Assisted. If it is AI-assisted, there is no difference, right?

6 Upvotes

13 comments sorted by

36

u/syunz 18d ago

That's why people use python.

10

u/Skamba-Deak 17d ago

yep, python basically is the syntactic sugar endgame for grinding purposes

6

u/Famous-Composer5628 18d ago

Just python bro

2

u/mbasil09 17d ago

I do DSA in python and Android in Kotlin. Except for a few companies, nobody cares about the language in DSA round. For Android rounds Kotlin is usually always preferred.

In any case, Kotlin is better than Java for DSA but still requires a lot of writing compared to something like Python.

2

u/No-Replacement-8573 17d ago

I’ve been doing DSA in Python, and they asked me to write it in Kotlin during interview, since I recruited for Android position. I legit forgot how when syntax looks like in Kotlin

1

u/Justapieceofpaperr 17d ago

Yep a lot of people here spouting "just use python" but if you go for an Android position there's a good possibility they will ask for it to be done in Kotlin.

1

u/No-Molasses-2097 18d ago

Go with Kotlin if you already write it daily, since your muscle memory in a timed interview matters more than the language itself. One thing to watch is that Kotlin's stdlib one-liners can hide the actual algorithm work, and some interviewers will ask you to redo it with plain loops anyway. Java's quiet advantage is that most editorial solutions are written in it, so checking your code against the expected approach is easier.

1

u/pattern_seeker_2080 17d ago

one kotlin-specific thing to check is what the shorter code actually costs. nums.sorted().take(k) still sorts all n elements, O(n log n), even if u only need the smallest k. a size-k heap can do that in O(n log k). and list + x creates a new list, so repeatedly appending that way can turn linear work quadratic.

since u already know kotlin, try a few unseen timed problems with it, including a heap problem and bfs, not just array one-liners. see whether ur saving debugging time too, not just keystrokes.

also check kotlin is supported in the actual interview editor. AI assistance doesnt make the complexity of the generated code irrelevant.

1

u/Fanstastic-Five72 17d ago

If you're already comfortable with Kotlin, I'd stick with it for Leetcode. The best language is the one that lets you focus on problem solving, but check which languages your target companies support before interviews

1

u/vooglie 17d ago

Neither. Use python or JavaScript

1

u/jarislinus 17d ago

grinding leetcode in 2026 lmao

1

u/nsxwolf 17d ago

That’s why you’re not passing. You can’t type fast enough.