Image for post
Image for post
Photo by Laura Ockel on Unsplash

The only way to get better at algorithms is through consistency and practice — so let’s jump right back in to another algorithm practice. This week, we’re going to take a look at the validate subsequence algorithm. This is an algorithm that is quite common and relatively straight-forward, so it’s a good one to practice with if you’re just starting out with algorithms.

Let’s take a look at the problem:

Given two non-empty arrays of integers, determine if the second array is a valid subsequence of the first array.

Note that both a single number in an array as well as the array itself are valid subsequences of the array.

Before we dive in to the problem, let’s first make sure we know what a subsequence is. A subsequence is a sequence that can be obtained from an original sequence by the removal of some (or none) of the elements without changing the order of any of the remaining elements. …

Image for post
Image for post
Photo by Jeremy Bishop on Unsplash

Data structures are the cornerstone of algorithms. In order to write and run efficient code, you must possess a solid understanding of data structures. Once you have a good grasp on different data structures and how they work, you can start to identify the pros and cons of specific data structures and then make an informed decision as to when and where they should be implemented.

A binary search tree — commonly referred to in its shortened form, BST — is a data structure that allows for the efficient storage of integers in an ordered fashion. Binary search trees are composed of a root node (the very first node in the tree) and any of its children nodes. These children nodes are named the left node and the right node. Binary search trees are so named because each node can have up to two children nodes. …

Happy 2021! It’s a new year and a fresh start, and we’re diving right back in to mastering algorithms.

I have been busy preparing for upcoming interviews and doubling down on getting algorithm practice in, so this week, let’s get in to the third iteration of the Algorithm Practice series.

Image for post
Image for post
Photo by timJ on Unsplash

Product Sum

This week, we will do a walkthrough of the Product Sum algorithm problem. It is another algorithm that often comes up during technical interviews. Given an array, our task is to write a function that returns its product sum.

Some things to clarify before we get in to thinking about how to tackle the task at hand. The given array (what we’ll call a “special” array) is always a non-empty array containing integers or other nested “special” arrays. …

The Caesar Cipher Encryptor is next up in our series of algorithm problem walkthroughs. Classified as an “easy” algorithm on websites like Leetcode, this is another classic problem that comes up often in technical interviews and is good practice for any Software Engineer looking to brush up on their problem-solving skills.

Image for post
Image for post
Src: IBM Community

Background Information

First, some background information on the Caesar Cipher so we know what we’re dealing with.The Caesar Cipher is a simple example of cryptography, which is defined by Merriam-Webster as: the enciphering and deciphering of messages in secret code or cipher.

Also: the computerized encoding and decoding of information.

The Caesar Cipher is predicated on the transposition of each letter of a string a specified number of places (the classic is three) in the alphabet. The Caesar Cipher is also known as a shift cipher since it involves the shifting of letters in order to conceal the meaning of the message. The Caesar Cipher is so named since it is said that Julius Caesar and his allies used this method of encryption in order to send secret messages involving military secrets (IBM Z Security). …

Image for post
Image for post
Photo by Joshua Sortino on Unsplash

Here’s a classic algorithm problem that comes up quite often in technical interviews: given a string, how can we check whether it is a palindrome or not?

Before we dive in to the problem itself, let’s step back for a second and go over what a palindrome is. A palindrome is a string that reads the same forwards and backwards. The classic example is “racecar” — read backwards, the string is still “racecar”.

Now that we are clear on the concept of the palindrome, let’s get in to the algorithm and how to approach solving it: Given a non-empty string, our task is to write a function that returns true or false based on whether the string is a palindrome. …

A Quick Dive Into Stacks

Image for post
Image for post
Photo by Tobias Fischer on Unsplash

Data Structures: Why Should We Care?

The first step in understanding and excelling at algorithms is having deep knowledge of data structures. Data structures are the foundation of Computer Science and Software Engineering, and as such, we have to have a good grasp of the basics of the most common data structures in order to be good at what we do.

While it might be intuitive, it is helpful for us to pause here and review what a data structure actually is. At the very basic level, a data structure is a way of storing, organizing, and manipulating a collection of data. …

Image for post
Image for post
Src: Amazon Web Resources

When developing an application, a common issue that developers run into is one involving CORS. This is an issue that is quite frustrating when it comes up — you’ve spent hours coding, testing, and cleaning up your code, only to find that CORS is blocking a request that your application depends on to run. Luckily, the issue is one that is well-documented and not too hard to fix.

What is CORS?

CORS stands for Cross-Origin Resource Sharing and it is a security policy that handles the way in which requests for resources from external origins are managed. The main purpose of CORS is to allow servers to control who is able to access their data, maintaining security and privacy. CORS allows servers to specify which origins can make requests for their assets as well as what type of requests (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS) they are allowed to make. …

Image for post
Image for post
Src: Hubtype

Nowadays, when you log on to any website, chances are that you’ll come across a chatbot. Chatbots are widely used across web applications in order to perform tasks — such as greeting customers and providing answers to frequently asked questions — that were once relegated to human beings.

Today’s chatbots are surprisingly complex, intelligent, and efficient, making them a no-brainer for most websites. While the AI and machine learning that goes in to chatbots are increasingly complicated, the task of building and customizing your own chatbot has become easier than ever. …

A Review of OOP and Its Core Principles

Image for post
Image for post
Photo by Eric Prouzet on Unsplash

What is OOP?

Object-oriented programming, often referred to as just OOP, is a programming pattern that revolves around the concept of objects. Objects are bundles of code that contain attributes and have behaviors in the form of methods. This idea of objects allows us to create applications that more closely mimic the way the real world works. OOP allows us to structure our code in a way that makes it possible to reuse our code and easily share functionality throughout an application.

Classes as Blueprints

In OOP, classes are an important concept. A class can be thought of as a blueprint for creating individual object instances. Much like a blueprint for a house, a class contains the specifications for building out an object. A class lays out the attributes (but does not assign values to the attributes) that an instance of the class will have and defines shared behaviors that members of the class have. Importantly, classes contain the instructions for creating new objects and have the ability to create those objects. …

How to reduce arrays properly in your code base

Street sign
Street sign
Photo by Photoholgic on Unsplash.

JavaScript has a few different array methods, each of which is useful for different cases. The Array.reduce() method is one such method. While the reduce() method might seem confusing at first, it’s definitely one that all developers should have in their toolbox. The reduce() method takes an array, performs a set of actions on each element of the array, and reduces it to one single value.

The reduce function takes the following syntax:

array.reduce(reducer, initialValue)// the initialValue argument is optional

As shown above, the reduce() method takes two arguments: a reducer function and an optionalinitial value. …


Cindy Kei

Fullstack Software Engineer based in NYC. Passionate about creating social change and making a difference through innovative, powerful technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store