I keep running into several algorithm problems revolving around recursion lately, and during some of these problems, I ran across an odd issue: My recursive qualities seemed to work, but my final result kept coming up as
Below is a function to convert a base-10 number to binary. It looks at the quotient of the number divided by two as well as its remainder, adding
1 to an array depending on the outcome.
Note: This function works for numbers up to a certain threshold, as binary numbers that are of a certain length are incorrectly rounded via…
At some point, you’ve probably run across the issue of comparing arrays with one another. Due to pass-by-reference, we can’t simply check if
[1,2,3] is the same as
This was an issue for me when I was trying to solve a Leetcode problem where the goal was to get all the permutations (possible order of characters) from a given array. I was able to randomize my arrays, but I wasn’t sure how to put them in another array only once, which is what the solution required.
In this article, we will discuss a solution to this dilemma. By iterating…
When I first came across data attributes in HTML, I was kind of thrown off. I understood how to set them up easily enough, but didn’t really get what they were for.
It turns out, I was trying to add weight to them that simply wasn’t there. They’re just a useful tool for developers to give HTML elements a little extra information. In turn, this info can be utilized to perform intricate tasks on your client-side, providing a different way of interacting with elements as opposed to manipulating them via their ID and/or class.
There’s already a plethora of attributes…
I recently started to pick up Java since I don’t have experience with writing static languages. Using Codecademy’s free courses, I’ve picked up some fundamentals and saw that their premium version had users build a basic calculator with Java. Now, I’m trying to save as much money as I can, so while I couldn’t be guided through making it, it’s definitely an easy enough exercise to do on your own.
This article assumes you know a little bit about the basics of Java, like how to set up classes and their instance fields and methods. …
If you’ve ready any of my articles, you’ll know that I’m as thorough as can be. What you might not know is that while I strive for meticulousness, I try to make that process as streamlined as possible. This means that if I can get by without having to use the mouse to navigate, you can bet I will.
This is why I love hotkeys!
To be frank, hotkeys (known as shortcut keys or keyboard shortcuts to some) help you cut the crap when it comes to working with a program.
At my old job, I was responsible for executing…
Recently, I was taking notes and trying to come up with an example of a function that would be used in a library that specialized in string manipulation.
I wrote myself a couple of examples, when an idea popped into my head: “Wouldn’t it be good practice to try and create a function that takes a string, and gives it back without vowels?”
That’s how I started coding this algorithm, which I decided to call
I just came back from the holiday break, so a light problem like this was a great way to get myself back into the…
Git management is one of those things you learn when you first start coding, then somewhat take for granted once you’ve gotten comfortable with the basics and set up your GitHub account.
It’s something that is very easy to get habituated with, not even thinking about it much if it’s not terribly involved in your work process.
But, if Git is one of the first things we learn as software developers, shouldn’t we try to build on that?
It’s been something I have been trying to learn more about recently, especially after an enlightening conversation I had at a networking…
Algorithms are a beast. Whenever beginners of software engineering discuss them, you can tell that, while interesting, they’re definitely intimidating to think about writing out.
At some point, you’re going to actually have to code one instead of just thinking about it. And it really doesn’t have to be grueling, even if you’re a beginner! At the end of the day, all algorithms really are just functions that do a specific thing while accounting for several conditions.
I am basically done with my most recent demo project, Mixit. It’s an app where users can peruse a database and mark drinks…
Merriam-Webster describes recursion as:
“a computer programming technique involving the use of a procedure, subroutine, function, or algorithm that calls itself one or more times until a specified condition is met at which time the rest of each repetition is processed from the last one called to the first.”
That sounds like a lot. In fact, the concept of recursion is simple. Basically, it’s a function that will continue to execute until a certain condition is met. …
Are you one of those overzealous users of
console.log? Do you find that when you load a page with the console open, you receive what is basically the Iliad in the form of short messages, each describing various props/state for components?
If you’re like me, sometimes you just want to know everything about your components at the time. It’s easy to forget who has what props and what the value of those props may be, depending on event listeners, parent components, and the like. The same goes for state. …