<-back 01/20/2024

I Made an E-Porfolio for Myself

I decided to create a personal website. I made it so I have a place to redirect people to all my social media and ecommerce links as well as to document random stuff that I have done throughout my career as an engineer.


Sometimes, my silly little mind has silly little thoughts that I think would be fun to journal so I wanted to use this website as a platform to share these ideas with you.

I got the idea to create a web portfolio when I first decided to up my game as a computer science student during sophomore year of college. I wanted a little corner of the internet all to myself and I thought this would be the way to do it. Plus, i was going through a LinkedIn phase where I was connecting with other people, checking out their profiles and what everyone was up to. I was also greatly inspired by people like Bruno Simon with his 3js interactive driving sim e-portfolio or Steve Losh with his "gets the job done" minimalistic but memorable e-blog.

I learned the basics of web development on mdn web docs, bless Mozilla. Their documentation is so easy to read and understand that even a noob like me quickly grasped the essential concepts of the box model and html structures (Although to be fair, html isn't exactly the hardest thing in the world). I was coding along with mdnwebdocs for a solid week or two before I transitioned to youtube tutorials. I built a website or two using youtube tutorials to get the hang of creating the basic components of a website such as a nav bar with html and css, then I decided to start working on my portfolio. I did the whole thing solo and it took me a few weeks of procrastinating because of work and finals, but we got it done. It was a really enrichening experience that let me delve headfirst into several new technologies.

I think this website is really goofy and it is essentially being held together with Elmer's glue and some scotch tape. In the future, I want to replace this portfolio with a React build. Creating these articles is also a nightmare because the entire blog was hardcoded so I want to eventually replace it with a CMS or maybe just improve the whole process of writing and managing articles with a database, since I did take that class last semester. For now, it serves its purpose. I guess. LOL. Expect lifting and tech related content in the future.

- Troy

<-back 01/24/2024

Leetcode Easy: 1.) Two Sum

The first problem on the popular data structures and algorithms practice site, Leetcode. There are many approaches to this problem but I want to explore a really simple way to solve it using a hashmap.


Problem

We are given a list of nums integers and asked to return the indices corresponding to 2 integers in the nums list that add up to a target value. We have been told that there is only one solution to the problem to simplify it. We want to iterate through the list, keeping track of each element and its index. We can do this with either enumerate or a for loop that iterates over the length of the nums list.

With the for loop, we have access to each value in the list and realize that by subtracting this value from the given target, we get the second number required to have two numbers that sum up to the given target because addition and subtraction are inverse operations.

We can move onto the next value if the two values calculated are not our target, but we want to add the processed value to our dict with the value as the key and the index of that value as the value.

Here, we can see that our for loop processes the first item in the nums array, which is a 2, and checks if its pair is already discovered and placed into the dict. If it hasn't discovered its pair, it makes a new dict item with "2" being the key and "0" being the value and moves on to the next iteration. In the second iteration, it has discovered that the pair exists in dict, so the code will return the index of the nums value it is currently processesing and use "target - nums[i]" as a key to the dict to find its pair and return the pair's index.

Methodologies

for i, n in enumerate(nums):

i will be the value of the index and n will be the value at nums[i]

for i in range(len(nums)):

i will be the value of the index of n

The heart of the problem: if the pair of n is already in dict, then return the indice of n and use the pair of n as the key to get the pair of n's index and return it.

Time Complexity / Space Complexity

We only have to traverse through the given nums array once, which can take as long as the length of nums. Finding the value of hash items with a key is a O(1) operation, so the time complexity is O(N).

We need to create a dict that has the possibility of being as long as our given nums array, so the space complexity is O(N).

This is considered the easiest Leetcode problem, but I actually think this one is a head scratcher if you are trying to solve it in O(N) time. People will intuitively try to brute force the problem, which will result in a terrible TC. I use this problem to practice things for the first time, like a new algorithms platform or video format or even a blog article.

This is the first problem I solved and made a blog for. I have discovered a few issues, especially with making code blocks in html, so I need to go fix those things. I want to also do problems in a more step by step manner. I also need to figure out a good setup for my file system so that things are well organized.

- Troy

<-back 02/09/2024

How I Leetcode

Leetcode is one of the most popular platforms to practice datastructures and algorithms. Its a great tool for practicing your technical interview skills and its like the gym for programmers. Here is how I use Leetcode.


Intro

I feel like an event called “the Leetcode epiphany” is a rite of passage for CS majors. No matter what grade level you may be, no matter where you are in your computer science journey, the term “Leetcode” haunts computer majors from when they start til they get their dream job. Leetcode is recognized as THE platform to practice technical interview problems and get better at data structures and algorithms. A lot of people hate studying data structures and algorithms and view it as a chore, because they either don’t enjoy the topic or don’t know where to start with studying dsa. Despite it being such an unenjoyable part of CS, technical questions are a prominent part of the interviewing process and is an interviewing technique that many companies employ to evaluate candidates. This is how I study Leetcode and some of the resources and techniques I used in my journey to getting my dream job.

Why?

Starting is really hard, as it is with starting anything. Learning new algorithms and datastructures is very rewarding because you are able to apply previously learned techniques to future problems. Leetcoding is also the ultimate puzzle game, if looking at it that way helps to motivate you to get started. Sometimes during the interviewing process, you have to pass a preliminary coding test before you talk to a human being. Currently, the job hiring process is pretty progressive, especially for internships, in the sense that companies look for people that show an enthusiasm and the ability to learn things because companies usually have a proprietary tech stack that they can teach you on the fly. They value people that can work well with others and are a good fit for their company culture. This is why Leetcode is important, but if you are trash it isn’t the end of the world. It’s also why it is important to learn the algorithms and data structures in detail so you can discuss it to great lengths, despite not being able to finish a problem.

Methodologies

I always start big projects by lubricating myself up to the overarching ideas by consuming random media on platforms that I enjoy such as Youtube and blog sites like the Verge or GeeksforGeeks. Take the advice that content creators give you with a grain of salt though; everyone is different and you need to find what works for you. Then, I graduate to a track, or a study plan that I can adhere to. There are a lot of user-curated ones online. My favorite is Neetcode.io, and I am planning to buy his 100 dollar program to study and review.

First, I try to do the problem on my own. If I have nothing by the end of the hour, I will look at the solution. When doing Leetcode, drop your ego and keep it moving if you don’t understand the problem. You will learn nothing starting at a blank IDE for hours on end.

Secondly, I work through the solution on paper. It is important to write through every single iteration within the algorithm to ensure a complete and deep understanding of edge cases and idiosyncrasies between problems. I keep a sketch journal to draw my way through problems. No need for organization, no need for labels. Just draw damn it, DRAW.

Thirdly, I will code the problem. If I need to use GeeksForGeeks or Neetcode as a crutch, I will. I am an advocate for prioritizing the understanding of the problem rather than syntax.

Finally, If time allows it I will create content over the problem. I love this part, because I get to prove my understanding of the problem and its very rewarding to create something and post it online on my little corner of the internet. I use this time to analyze time and space complexities, as well as discuss fun things like issues that the problem gave me.

Pacing

I try to Leetcode everyday. I try to do one problem a day. I try to do one video a week. Blogs over problems are sparse because I don’t want Leetcode oversaturating my blog feed. Taking a break is insanely frustrating for me because it makes me feel like I am regressing in progress. It is something I am going through right now, and I am skimming through Neetcodes’ pathway and everything feels so fresh, but you gotta do what you gotta do I guess. It'll all be worth it in the end. WAGMI.

- Troy