Coding, reflecting, evolving.
2025 May 3rd
I went through a period of intense study, focusing on solving problems with C++. Now, I'm back to Python and happy to walk through this solution to longest valid parantheses. class Solution: def longestValidParentheses(self, s: str) -> int:…
2025 February 13th
I completed the LeetCode 150! Since then, I haven't stopped practicing. I want to master common algorithms and feel confident for future interviews. For this problem, I started with this greedy solution. We always flip a zero if we haven't done so…
2025 January 21st
Today I start working on multidimensional DP. I expect these problems to require a dynamicly-sized array to build a solution, rather than a static number of variables. I chose to write about this problem because it is a great example of how we can…
2025 January 7th
We're working through binary search problems. This one has an initial solution with many lines duplicated. We further work the solution to use a function and a boolean variable to make the code more clean via the DRY principle. class Solution:…
2024 December 28th
Today I worked on a general graph problem. My initial solution was much more verbose and less readable than another coder's solution. However, I feel like during an interview I would have been able to derive the simpler solution through asking…
2024 December 25th
Here's another backtracking problem. For this post, I'd like to discuss the differences between my solution and another submitted solution. class Solution: def generateParenthesis(self, n: int) -> List[str]: results = [] def…
2024 December 21st
I've been working on backtracking problems. For this one, it helped to visualize the recursion stack using Python Tutor. Also, I will have to revisit this later as the complexity analysis is out-of-the-ordinary. class Solution: def combine…
2024 December 18th
This problem stumped me for a while because I needed to use a dictionary to make sure I didn't have duplicate copies, then I also forgot to return the copy at the end of the DFS algorithm. """ # Definition for a Node. class Node: def __init__…
2024 December 14th
Here are two solutions. One is recursive and the other iterative. The iterative solution is better as it can handle larger inputs. Recursive from collections import deque # Definition for a binary tree node. # class TreeNode: # def __init…
2024 December 12th
I am glad I was able to make a solution from my own intuition. from collections import deque # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self…
2024 December 5th
This is the last month of my goal toward 150 problems done by 2025. I'll have to pick up more than a few problems this weekend. I have 56 problems remaining. from collections import deque # Definition for a binary tree node. # class TreeNode: #…
2024 November 28th
Happy Thanksgiving! I am happy to have solved this without looking up a solution. However, I did have to review traversals. from collections import deque # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0…
2024 November 26th
This took me a few days although it's only a medium! It is important to remember Python is pass-by-reference. I spent a lot of time debugging because I didn't mirror changes between previous and next nodes when moving a node between them. I was…
2024 November 23rd
I had to read the comments to understand this problem. I didn't understand how they wanted the ordering until I read a few examples. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self…
2024 November 21st
The trick for this one was tracking duplicates via the unique boolean and a pending variable. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next…
2024 November 20th
Today I chose an easy problem since I had a late day at work and gym afterwards. from collections import deque # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val…
2024 November 19th
I had difficulties with this problem with terminating completed lists. I was surprised that ChatGPT didn't give this simple solution, it suggested a large rework. I'll have to be mindful before implementing all of ChatGPT's suggestions. # Definitio…
2024 November 18th
I was able to reduce this time complexity from O(n) = 2n to O(n) = n by using a list for the elements to be reversed, and then only modifying those rather than stepping through all nodes while reversing. # Definition for singly-linked list…
2024 November 15th
This problem was tricky as I had to track Node references rather than the index given in the input. from collections import defaultdict """ # Definition for a Node. class Node: def __init__(self, x: int, next: 'Node' = None, random: 'Node' =…
2024 November 14th
Final stack problem for this practice set is a hard question. Took me an hour and a half to come up with this convoluted method. Parsing numbers character by character was my first mistake. class Solution: def calculate(self, s: str) -> int:…
2024 November 13th
Now I'm on to stacks. I had to rethink my strategy of going from right to left, to left to right. I was overcomplicating it. class Solution: def evalRPN(self, tokens: List[str]) -> int: stack = [] for token in tokens:…
2024 November 12th
This took me a long time to cover all cases. class Solution: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: start, end = newInterval inserted = False res = [] for…
2024 November 11th
Now I'm onto intervals. This one merges all intersecting intervals and returns the distinct items. class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: res = [] intervals = sorted(intervals)…
2024 November 9th
Working on hashmap problems now. from collections import defaultdict class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: indexToSortedWord = defaultdict(list) for i, word in enumerate(strs…
2024 November 6th
Final matrix problem, this one a bit special to me. My first repo in Github is for a Game of Life program in C++. I created it in 2011 as a science fair project. This method uses constant space by usind integer division and modulo operations. We use…
2024 November 5th
Working through more matrix problems today. I used a method where we transpose the matrix, then reverse the rows. This is memory efficient in space and locality. class Solution: def rotate(self, matrix: List[List[int]]) -> None: """…
2024 November 4th
Now, I am working on matrix problems. This is my initial greedy solution. class Solution: def isValidSudoku(self, board: List[List[str]]) -> bool: for row in board: rowVals = set() for column in row:…
2024 November 3rd
Last problem for this study set's sliding window problems. This is my initial greedy solution. It passes initial test cases, but fails longer inputs. class Solution: def minWindow(self, s: str, t: str) -> str: def containsT(substring):…
2024 November 2nd
Starting with a hard problem today. class Solution: def findSubstring(self, s: str, words: List[str]) -> List[int]: lenTotal = len(''.join(words)) perms = set() def permutations(head, tail): if not len(head):…
2024 November 1st
This took a while to solve. I completed it over two days, then I had the help of ChatGPT to analyze the complexity. I reviewed other answers and I didn't find simpler methods. class Solution: def fullJustify(self, words: List[str], maxWidth: int…
2024 October 31st
This was an easy problem. class Solution: def strStr(self, haystack: str, needle: str) -> int: for j in range(len(haystack)): if haystack[j:j + len(needle)] == needle: return j return -1 O(n) = n
2024 October 30th
This one took me about 15 minutes to come up with a solution. I then worked through it with this naive solution. class Solution: def convert(self, s: str, numRows: int) -> str: grid = [['' for column in range(len(s))] for row in range…
2024 October 28th
Finished a couple easy problems, then this medium problem. I feel like this was made easier by python's list slicing. class Solution: def reverseWords(self, s: str) -> str: return ' '.join(s.split()[::-1]) O(n) = n
I started feeling down about my past interview performance. Rather than continue ruminating, I decided to continue my LeetCode grind tonight. My goal is to complete the Top 150 Interview Questions before the end of the year. class Solution: def…
2024 October 22nd
Getting back into the habit of solving LeetCode problems. Today's problem is LeetCode 74. Search a 2D Matrix. We have to solve this in O(log(m*n)) time complexity. So, I think of binary search in 2 dimensions. Once for the row, and once for the…
2024 October 15th
The intial phone screen for the StubHub interview went well. I was asked about my experience with Terraform. I admitted that I have only used it once before. and it has been many years since then. However, I used AWS CDK frequently at my last job…
2024 October 13th
I'm looking forward to an interview for a software engineer position at StubHub. It offers work with microservices, kubernetes, and cloud-native technologies. The position focuses on DevOps, such as infrastructure, build, deployment, and artifact…
2024 October 8th
I've began a new project, scholarships-plus. This will be a CRUD app for tracking and improving scholarship essays. I am creating this app to improve student's scholarship essays by improving their past submissions. This app will allow students to…
2024 October 7th
Today I decided to embrace the AI revolution and try out Cursor. I'm going to write a quick LeetCode solution, then dive into some project ideas. The Problem Since we have some help from Cursor tonight, we wil be solving a hard problem. Today's…
2024 October 6th
We're solving another LeetCode problem today. Tomorrow I will add my new project. Let's dive in. The Problem Today's problem is 9. Palindrome Number. The problem is as follows: Given an integer x, return true if x is a palindrome, and false…
2024 October 5th
We're solving another LeetCode problem today instead of adding a new project to my portfolio. This one is focused on bit manipulation. Let's dive in. The Problem Today's problem is 191. Number of 1 Bits. The problem is as follows: Write a function…
2024 October 4th
Today is another easy problem, and it is focused on bit manipulation. Let's dive on in. The Problem Today's problem is 190. Reverse Bits. The problem is as follows: Reverse bits of a given 32 bits unsigned integer. The Solution I like to format my…
2024 October 3rd
I have already been working on LeetCode's top interview problems. I started a couple months ago in preparation for my interviews with Google. Although that has passed, more opportunities are becoming available. So, we are back on the grind. The…
2022 October 9th
To remove the Zone:Identifier files, execute: find . -name "*:Zone.Identifier" -type f -delete Then to prevent these files from showing up again... Open gpedit.msc Open `User Configuration > Administratives Templates > Windows Components…
As we transition into the professional world, we are faced with many questions. How much do we save for retirement? Would you like to split your check? Are you successful? To answer these questions, we need a vision so we may set goals to measure…