-
Outliers
Oh boy, this one involved some thinking. The problem is to find the outlier in an array of integers. You are given a list that has a minimum of three elements but can have up to a thousand. The array will always have either all even numbers and exactly one odd number or all odd…
-
Expanded Numbers
For today we have a number problem. The idea is to take an integer and return the expanded form. This problem wasn’t particularly difficult or tricky and honestly finding a wrong approach would have been harder than finding two correct approaches. Example Input: 12, Output “10 + 2” Input 42, Output “40 + 2” Expanded…
-
Brace Validation
Yesterday I did the valid parentheses problem and came up with two solutions, that worked. One was overthought while the other was simplicity defined. The next logical question one can ask though is what if we now want to do brace validation? I.e. there are more than just brackets? What if we include curly braces{},…
-
is DOMRect not serializing for you?
Today I was writing a playwright test that needed to do some calculations on an element’s coordinates. No problem right? Just get the DOMRect object from getBoundingClientRect and go about your day. Easy, expect that rect was an empty object. It took me a second to figure out, but it appears that DOMRect is not…
-
Code Corner: Triangles
For the last two weeks, I’ve had a bunch of interviews and code challenge tasks I was taking which took up a lot of my time. Add that to #DadLife and the result is two weeks with no content. The pressure is off for the moment so I’m picking it up again. So for today:…
-
Code Corner: Nested Squares
Problem Draw three nested squares in html and css. My Solution Simple, you need three divs nested inside each other with a unique way of referencing them, the rest is done in CSS. I set the body to gray because reasons, there is really no need to do this. The first part is that all…
-
Code Corner: Counting Multiples
Problem We are given 3 numbers, a starting number A, an ending number B and an integer K, find the number of multiples of K there is between A and B inclusive. Source Example a = 6 b = 9 k = 2 Should return 2 My solution The ranges are irrelevant because this is…
-
Code Corner: More Array Hijinks
Problem We have another array operations question. This time we are given two inputs, a number n and a 2d array of operations. Each of the operations has 3 values, a start index, an end index and an increment value. Source: HackerRank The task is to implement each of those tasks on to a new…
-
Code Corner: Counting Operations
Problem Codility MaxCounters We are given a number n and an array A of length m where each value in A is less than n+1 and greater than or equal to 1. We have to create a function that executes two operations using a new array of length n with initial values 0. The array…
-
Evolution of Code Style
When I started programming I developed a particular code style. This style was defined by how I structure my code, how I name things etc and was heavily influenced by the senior developers I worked with. Over the years I developed my own personal style which was evolved with every project I did and every…