I'm on a mission to master programming and tackle any coding challenge that comes my way. In this series, you'll find my daily journal entries, presented as simple bullet points. Nothing fancy—just my honest thoughts and experiences from each day. So, please, no judgment! 😂
Join me as I document my tech journey in Bangalore. Let's dive in!
Day 2 (01/07/24)
Today's LeetCode Question was a bit on the easy side 1550. Three Consecutive Odds
Nothing special to see here the question just required a for loop. This one didn't take more than 2 mins.
Here's a fun one liner I found though:class Solution: def threeConsecutiveOdds(self, arr: List[int]) -> bool: return '111' in "".join([str(x&1) for x in arr])
Just converted the array of numbers into
'1'
or'0'
strings based on whether they are even or odd, and then joined the entire array into one string so I can look for three consecutive '1's in the string. Found that we can also usex & 1
to check for odd numbers instead ofx % 2
. I mean, it makes sense—in the binary representation, the last bit of every odd number will have a 1, so performing a bitwise AND operation between any odd number and 1 will always give us 1.Started the strivers-a2z-dsa-course, I'll be done with the basics section by tomorrow.
Watched a couple of videos on the C++ STL (I just hope I'm able to remember all that when I'm implementing solutions)
Learnt about some nice concurrency patterns in Go from this awesome video, gonna watch it again tomorrow and practice a bit
That was it for today, the rest of my day was spent cleaning around the apartment and finding shops to buy groceries lol
The weather was very nice! ☁️ (I should probably go outside more often)
Anyway that's about it for today! See you tomorrow! 😄