Matt Coneybeare

MC

Coding Challenge: Detecting Unique Friend Circles in NxN Matrix

| Comments

Friend Circle. Photo by Margarida CSilva on Unsplash

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to implement an algorithm or process from just its definition or description is good practice to keep you sharp.

Yesterday, I came across a question on LeetCode that asked me to find the total number of friend circles given an N by N matrix showing their relationships. Here is how I implemented a solution in ruby:

Coding Challenge: Remove and Rearrange Array Elements In-Place in O(1) Memory and o(n) Time

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to implement an algorithm or process from just its definition or description is good practice to keep you sharp.

Yesterday, I came across a question on LeetCode that was asking me to remove all elements of an array that match a certain value. Pretty simple right?

1
array - [value]

Wrong. There is a catch which means this above solution cannot be used. We are required to perform the removal in constant O(1) memory, so we can’t create any new arrays, or modify the existing array. We are asked to do it in O(n) time as well. So we need to modify the array in place, while looping over its length max one time. Here’s how I did it.

Coding Challenge: Implement a Square Root Function

| Comments

(not the sqrt function)

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to implement an algorithm or process from just its definition is good practice to keep you sharp.

Yesterday, I came across a question which was rated on LeetCode as EASY and decided to give it a go, finding that the optimal answer was anything but easy. The question was:

1
2
3
Implement int sqrt(int x).
 - Compute and return the square root of x, where x is guaranteed to be a non-negative integer.
 - Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.

Here’s how I naively implemented that in ruby.

Coding Challenge: Finding the Longest Absolute Path in an Abstracted File System Display

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, and very few truly unique problems, so challenging your brain in this way is good practice to keep you sharp.

I’ve been working lately on LeetCode and came across this interesting problem titled Longest Absolute File Path. The problem gives us an abstracted, serialized representation of a file system directory structure, and asks us to find the longest absolute file name in the system.

In this representation, each \n represents the end of line (dir or file), and each \t corresponds to the files depth in the system, though there is no information one can deduce about its path to get to that depth. For example, this string…

1
"dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2\n\t\t\tfile2.ext"

…actually maps to a directory that graphically looks like this:

1
2
3
4
5
6
7
dir
    subdir1
        file1.ext
        subsubdir1
    subdir2
        subsubdir2
            file2.ext

Coding Challenge: Converting Integers to Binary String Representations in Ruby

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to implement an algorithm or process from just its definition is good practice to keep you sharp.

I had come across a practice coding question which required me to compare integers and binary strings, and I realized that I had forgotten how to convert an integer to binary. Looking it up, the algoritm is pretty simple:

To convert integer to binary, start with the integer in question and divide it by 2 keeping notice of the quotient and the remainder. Continue dividing the quotient by 2 until you get a quotient of zero. Then just write out the remainders in the reverse order.
Angular in Depth

Here’s how I implemented that in ruby.

Coding Challenge: Implementing QuickSort in Ruby

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to implement an algorithm or process from just its definition is good practice to keep you sharp.

Previously, I had implemented MergeSort in Ruby, so today I am going to take the next step and implement the faster QuickSort algorithm.

Coding Challenge: Implementing MergeSort in Ruby

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to come up with or code an algorithm or process from scratch without that assistance is good practice to keep you sharp.

Previously, I had come up with three solutions of finding a missing number in array of 1 through 100, and today, after reintroducing myself to the algorithm, I am going to implement a O(N) search method: MergeSort.

Coding Challenge: Find Missing Number in Array of 1 Through 100

| Comments

Lately I’ve been trying to challenge myself by taking a stab at some common coding questions asked in software engineering job interviews. After years of working on apps you would think that this kind of thing comes easy, but software development in the modern age comes with a heavy side of Googling and lookup, so challenging your brain in this way to come up with an algorithm or process from scratch without that assistance is good practice to keep you sharp.

One of the first problems I attempted was the relatively easy:

How do you find the missing number in a given integer array of 1 to 100?

Watch Later for Plex iOS App Lets You Easily Add Videos to Your Plex Queue

| Comments

I am pleased to announce that my company, Urban Apps, just released our newest iOS app, Watch Later for Plex, on the iTunes App Store!

Watch Later for Plex

Watch Later for Plex isn’t the world’s most revolutionary App. It’s not going to be an App you open every day, and it’s not going to become a viral sensation. The App is also useless for you unless you use Plex to organize and watch media, and also use the Plex Queue to bookmark videos around the web for you to watch later. If you do use these things though, then this iOS App is very useful to you.

My name is Matt Coneybeare, I design and develop for iOS (iPhone, iPad and iPod Touch), Mac OS X and the Web out of New York. In 2008 I started a software company called Urban Apps that has made some pretty popular apps such as Ambiance and Hourly News. My current Stack Overflow reputation is about 27k.

I was a Rockstar a decade ago, but then went back to school and collected a Bachelor's Degree in Computer Science from U.C. Berkeley. Now I am settled down with my beautiful wife Di and our dog Hamachi. When not at my desk, I love exploring New York City as a Yelp Elite, or training for marathons.

Contact information

Name
Matt Coneybeare
Email
Website
Twitter
Instagram
GitHub
LinkedIn