Terrible (ASMR) LeetCode in Kotlin:

Опубликовано: 16 Октябрь 2024
на канале: Personal Finance with Raymond
85
0

Another day, another LeetCode question (for now). Today, I'm running through #217 on LeetCode, Contains Duplicate. The input provides an array of integers and asks for a boolean output on whether the array contains a duplicate element. At the end of the day, I used a set to keep track of all of the elements that I've seen before, returning true if we find an element that's already in our set or false if we iterate through the array without tripping up the if statement.

I work in Kotlin as my LeetCode programming language because my current focus is on Android app development. Kotlin is interoperable with Java, so the solution should be relatively similar albeit with some more boilerplate checks for nulls and such.

Sorry for the lack of commentary on this one! My throat is sore from COVID and I decided to make this one silent with the exception of my keyboard. Enjoy.

Current Grind:
Grind75 list, 22 weeks/7 hours per week, [25/169]
(https://www.techinterviewhandbook.org...)

Chapters:
00:00 - Opening, set tracking