-
Code Corner: Max of 3
Problem Given an n-length Array of integers ranging from -1000 to 1000 find the largest product of three numbers in A that you can get. Source Example [-3,2,6,4,8] => 192 My Solution There are three basic scenarios that can produce the largest product: The largest three positive numbers The largest positive number and the smallest…
-
Code Corner: 1-minute rule
So today’s task was so easy I’m going to do another one because I solved it way too fast. It’s really not that hard if you know some built-in data structures. Problem Source Given an n-length Array of numbers between -1,000,000 to 1,000,000, find the number of distinct values in the array. Example A =…
-
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…
-
Code Corner: Missing Number
Problem Source: Codility Given an array A of length n filled with integers find the smallest missing positive number. Example: [4,8,1,3,2] => 5 [1,2] =>3 Restrictions n ranges from 1 .. 100,000 Values of A range from -1,000,000 to 1,000,000 My Solution As usual, I decided to first take a brute force approach. As a…
-
Code Corner: Long Factorials
Long Factorials Calculating the factorials is one of the most basic algorithms out there. It’s so basic it’s actually used to teach a harder concept, recursion. I’m explaining this so that I can get away with using the 2-minute explanation of both concepts. Let me know if you’d be interested in a deeper dive. Recursion…
-
Code Corner: Permutation Check
The problem: We are doing a permutation check. Given a list A with n elements and the task is to determine if A is a permutation of natural numbers from 1 to n. For example [4,2,3,1] is a permutation since all element of the list are in the list [1..n] where n=4. [4,1,2] is not…
-
Hacking My Password Manager
I keep all of my passwords in a password manager. My password manager of choice is Keepass. I used because it’s open-source, free and doesn’t require me to be locked into a cloud-based server. If I require syncing across devices then I can use Google Drive or iCloud services I’m already using. This means the…
-
Remote Work is here
Remote work is here. Developers have known for ages that all you need to work is a laptop and internet, now thanks to COVID everyone else does too. I’ve worked remotely for the better part of three years now, starting back in 2017 when I was doing consulting in the UAE. I went there physically…