# 08 May 2020 | Leetcode May: Catch up! (1 through 8) Plus Cards

I had a day filled with coding. I did eight leetcoding challenges for the May challenge (which I didn’t know existed until today), and started on the binary search card. Every single one of these is ranked Easy.

This is pretty basic stuff. I chose the recursive solution for binary search over the iterative solution.

As for the challenges, they’re all pretty easy and self-explanatory. One I thought was really interesting was the “bit shifting” problem.

This one I thought was really interesting because it says you can’t brute force it, but it let me brute force it. This is why I decided to do the Binary Search card. Apparently, the challenge is supposed to fail you for brute forcing, and only approve binary searches - but I’m guessing Go is fast enough to where it couldn’t detect that I just brute forced it :)

## Jewels and Stones

This is a classic. I’ve probably solved this 3 or 4 times before. Probably the easiest programming challenge known to man.

## Ransom Note

There’s a bit of a gotcha if you don’t use built-ins (which I tried not to, IE “contains” method), but this is still a 5 minute problem tops.

## Number Complement

From all the binary work I’ve done in college, I would have figured this would be simple. You’re just shifting the bits, how hard could it be? Well, it’s not extremely challenging, but it took some research into the bits package. Note: This can also be done without the bits package, but it’s not as clean.

## First Unique Character in a String

Again, not a hard problem so I decided to operate entirely on bytes and not use any built-ins. Turned out to be an extremely performant solution, faster than 90% of other submissions.

## Majority Element

Another straightforward problem. The intuitive solution uses a map and is O(n).

## Check if it is a Straight Line

I absolutely lost it during this problem. This really should not be difficult, but Go refused to provide a float from integer division unless I casted literally every single element into a float64. I find this is one of the things that irritates me about using Go as compared to Java. I could really write an entire blog post at this point about things in Go that I’ve found that infuriate me. Among this would be lack of generics and the interface implementation.