- Published on

## Leetcode 20. Valid Parentheses (JavaScript)

Today let's take a look at Leetcode problem 20 - Valid Parentheses

Most recent post: October 29, 2024

- Published on

## Leetcode 20. Valid Parentheses (JavaScript)

Today let's take a look at Leetcode problem 20 - Valid Parentheses

- Published on

## Using Jest toHaveBeenCalledWith() with expect.anything() to test a subset of parameters

Last week I had an interesting problem come across my desk. I was tasked with ensuring that when an

`onClick`

handler was fired that a certain object was returned in the callback. Now this object would depend on the form state so I wanted to test several permutations. What was making things difficult was that the onClick callback returned a second object with many utility functions that were inherent to an underlying library and I wasn't interested in checking them as part of this testing.- Published on

## Leetcode 701. Insert into a binary search tree

Today we will be going over Leetcode 701 - Insert into a binary search tree. This is a classic DFS (depth-first search) problem we will implement using recursion.

- Published on

## Leetcode 103. Binary Tree Zigzag Level Order Traversal (JavaScript)

Today we will be reviewing Leetcode 103 - Binary Tree Zigzag Level Order Traversal which provides a good use case for breadth first traversal (BFS) of a tree.

- Published on

## Leetcode 111. Minimum Depth of Binary Tree

Today we will being going over Leetcode 111 - Minimum Depth of Binary Tree. This is a classic DFS (depth first search) problem we will implement using recursion.

- Published on

## Leetcode 88. Merge Sorted Array (JavaScript)

Let's take a look at yet another classic in-place array problem with LeetCode 88 - Merge Sorted Array

- Published on

## Leetcode 27. Remove Element (JavaScript)

Let's take a look at a classic in-place array problem with LeetCode 27 - Remove Element

- Published on

## Leetcode 121. Best Time to Buy and Sell Stock (JavaScript)

It's time to mix an array problem with some light dynamic programming in LeetCode 121 - Find Numbers with Even Number of Digits

- Published on

## Leetcode 203 - Remove Linked List Elements

Hello there! Today we will continue our journey into linked lists with Leetcode 203 - Remove Linked List Elements. This is a quite common question to solve with regards to efficiently removing nodes from a linked list.

- Published on

## Leetcode 206 - Reverse Linked List

Hello and welcome to another algorithm problem review! Today we will continue diving down the linked list rabbit hole to discuss Leetcode 206 - Reverse Linked List

- Published on

## Leetcode 141 - Linked List Cycle

After a rash of string and array problems I thought we would take a break today and start discussing linked lists. To start out let's take a closer look at Leetcode 141 - Linked List Cycle

- Published on

## Leetcode 1295. Find Numbers with Even Number of Digits (JavaScript)

We continue looking into array problems with LeetCode 1295 - Find Numbers with Even Number of Digits

- Published on

## Leetcode 485. Max Consecutive Ones (JavaScript)

I am back after a brief hiatus! Over the next several posts we are going to cover some very common array problems. Let's start with LeetCode 485 - Max Consecutive Ones

- Published on

## Free Code Camp (FCC) - Symmetric Difference

Today we will review Free Code Camp's (FCC) Symmetric Difference algorithm.

- Published on

## Free Code Camp (FCC) - Pairwise

Today's algorithm we will examine is Free Code Camp's (FCC) pairwise algorithm which deals with list traversal.

- Published on

## Free Code Camp (FCC) - No Repeats Please (Heap's algorithm)

Hey everyone! Sorry it's been a while. I need to take a short break after working through several algorithms. I hope to get back to regularly solving algorithms and contributing posts! A good start today will be solving Free Code Camp's No Repeats Please problem throug the use of Heap's Algorithm.

- Published on

## Cracking the Code Interview 1-8 Zero Matrix (JavaScript)

Let's talk about zeroing out rows and columns in a matrix when a 0 is found in today's post about Cracking the Code Interview 1-8 Zero Matrix.

- Published on

## Cracking the Code Interview 1-9 String Rotation (JavaScript)

Today we will be talking about Cracking the Code Interview 1-9 which covers string rotation.

- Published on

## Cracking the Code Interview 1-3 Urlify (JavaScript)

Hello everyone and welcome back! Today we will be discussing my solution to Cracking the Code Interview 1-3 - Urlify.

- Published on

## Cracking the Code Interview 1-2 Check Permutations (JavaScript)

Today I will go over the Cracking the Code Interview 1-2 Check Permutations.

- Published on

## Solving Leetcode 70 - Climbing Stairs (JavaScript) (Fibonacci sequence)

It's been a lot of fun completing one algorithm problem a day! I feel there is plenty time to go but I firmly believe given enough variety (and time) I will better master critical concepts. We previous have worked on two sum and atoi() which involve some clever tricks and helper methods that JavaScript provides. Today we are going to talk about something a little different and start dipping our toes into the concept of recursion and iterative solutions with leetcode 70 climbing stairs.

- Published on

## Solving Leetcode 8 - String to Integer (atoi) (JavaScript)

**atoi()**is a very classic C library function that converts character string into an integer. Otherwise if it is unable to do so it returns the integer 0. Now of course if you've visited Mozilla's famous MDN website to get help on web technologies atoi conspiculously returns no results. Because as it turns out we have other methods/practices for converting numbers to string (and vice versa). But to me the real challenge of this problem is not necessarily figuring out how to convert a string to a number but rather all the corner cases one must consider to implement an atoi() function in JavaScript.- Published on

## Solving Leetcode 1 - Two Sum (JavaScript)

As I mentioned in my about me section I do not have a traditional CS degree. My background consists of being a former semiconductor test engineer with a MS in Electrical Engineering and a Bachelors in Applied Mathematics. I have learned so much in the past one and a half years as I have continued to build things.

That being said I feel at this point there is a strong need for me to work on the data structure and algorithm fundamentals I never learned. So over the course of the remainder of the year I will be digging into many of these topics and as I write solutions (this example is Leetcode based) I hope to share with you my thought process and code.

- Published on

## Cracking the Code Interview - Is Unique

When I was formally in school I majored in Electrical Engineering and Mathematics. I had two formal semesters of c++. But after I did a small amount of OOP and a binary search tree implementation I basically was relegated to machine level coding (think assembly). So unlike my friends in the CS department I really had no formal training in data structures, algorithms, or any of the other fundamentals software developers likely take for granted in their education

Thus in 2020 I plan to work all the way through Cracking the Code Interview (yes that infamous green textbook) to catch up to my fellow developers and be able to continue my technical growth. As I solve algorithms I will be posting my solutions and explaining my thought process. I don't expect them to be perfect initially. And in fact I probably will write follow-up posts as I make revisions or additional implementations. But as as a nice warmp up today I thought we might start with example 1.1 from CTCIIsUnique

- Published on

## The Next Best Time

Procrastination and imposter theory are real things. It's so easy to convince yourself you aren't ready for something. But these are simply excuses. The best time to have started something was yesterday. The next best time is now. For over a decade I told myself I would build a blog and write articles that people might read. At this time I was a budding electrical engineer. I was ready to start working on my circuit design and post articles about what I learned. I came up with grandiose ideas of what such a blog might look like. And I was all in on the idea of picking up HTML/CSS/JS to accomplish this.

Instead I did nothing

- Published on

## Stack

For a long time i've wanted to learn data structures and algorithms. I decided with the new year it was finally time to get started. After all the best time to start something was yesterday. The next best time is today. The first stop in learning data structures is stacks. You can technically use an array as the base of building a stack in JavaScript but I instead elected to start with an object. This is my version of the implementation:

The implementation starts out by using a class object. The constructor method is used to initialize the class with a known state. In this case we initialize two variables.

`_storage; _length;`

_storage represents an empty object. This will be our primary data storage element. Whenever we take an action to add, remove or view data from the stack this will hold the data. _length represents the amount of elements inside the _storage object. This is useful as it allows us to index elements throughout the class. Now that we've covered the constructor variables we can move onto the methods!

- Published on

## Updating Bootcamp project for npm security updates

Each time I visit my GitHub account page I find myself bemused by the number of security PR requests I see on my old bootcamp projects. A year ago many of these projects seemed almost impossible if not insurmountable. Now a year forward most seem fairly straightforward that I probably could crunch out in a weekend.

I had a moment where I considered whether it was worth to continue updating these dependencies every few weeks. It might save a me a little time and let me leave these behind.

In the end i decided to take the time and make the update. These project are a representation of who I was months ago and the journey I took to come to this point. My job now is to continue building things that will lead me to be the developer I want to be.

So if dependabot wants to make a call. I will be there to merge them all. 😃

- Published on

## Role Tab

As a front end developer one my weak areas is a11y. I was working a bug today at work involving an implementation that utilized tabs. Per my coworker in order for the feature to work I needed to utilize aria-selected and aria-controls.

I implemented the feature and things were working great in Chrome with voiceover. However to my surprise and dissapointed it failed testing in Safari. Initially I was very confused as to how this was possible. Finally after about 15 minutes of debug I realized that I had placed the aria-select one level too high. Oddly enough chrome seems to automatically appends aria-selected=true when a tab has role="tab" and it is tab active. Safari makes no such behavior.

I hope this helps you if you run into a similar situation!

- Published on

## Big trouble with parseInt()

The need for input validation is important. In my case I was wanting to validate that a URL parameter was infact a valid integer. I went on MDN and found a handy function called parseInt(). I pushed the feature and it appeared to work just fine.

However my QA engineer pointed out that when she tried to use a URL param of 123wlkdfasdfasdf that infact the number 123 was parsed. I re-read MDN and realized that it turns out parseInt will actually parse an integer happily until it hits something thats not an integer. Then it discards the rest of the input.

The solution I went to instead involved using a regex where I basically looks for characters only between 0 - 9.

- Published on

## Hello World!

Hi there. My name is Paul. I am a fairly new web developer with a primary focus on front end. My background before becoming a full-time software dev was 7.5 years in the semiconductor industry as a test engineer. I've been helped quite a bit by posts on the web as I have continued to improve my javascript accumen. So I want to give back and give everyone some perspective as I learn new and cool things. Check back as I make occasional posts on things I learn. Take care!