In this article I’ll be going over the leetcode question length of last word. In this problem the main topic it will cover are strings. Here’s the breakdown of the problem.

Given a string s consists of some words separated by spaces, return 0.A word is a maximal substring consisting of non-space characters only.Example 1:Input: s = "Hello World"
Output: 5
Example 2:Input: s = " "
Output: 0

So looking at this problem it says that the words…


CSV stands for comma separated values which is commonly seen in excel spreadsheets. While on a program like excel the data will appear with columns and rows inside its own cells, once viewed as raw code the CSV file will look something like this.

"name, age, gender"
"Bill, 24, male"
"Ana, 20, female"

Ruby has a built in library that allows us to do many things with CSV files. To begin go ahead and create a new file and add

require 'csv' 

at the top. Now that you can use an entire set of methods to do what you’d like…


Test driven development (TDD) allows developers to ensure that they’re on the right track in their development roadmap. In this article I’ll go over some basic Rspec tests that can be used for your controllers in your Rails API. Before we start add the ‘rspec-rails’ gem to your gemfile. The run

bundle 

in your terminal to install it. Now you go ahead and run

rails generate rspec:install

This will then create a spec directory and a .rspec file. From here we can create our tests that we’ll run. It’s important to note that the tests you will run in your…


Above is a definition of a package manager from Wikipedia. Let’s quickly break it down to better understand what we’re working with. A package is a reusable piece of software that you can download from another source into your local environment. Now a package manager will…


The React Native FlatList is a very useful component for rendering a refined list of all your data that you are trying to display. It’s most commonly used when displaying a list of contacts or news article headlines. A basic overview of how the components are rendered is that one file will fetch your data and pass it down to your components as a prop. From there the component that receives that props uses them to render your desired data onto your components. Let’s walk through a quick example building out a flatlist that renders some news articles.

For this…


The REST architectural style has been the standard for designing APIs for quite some time. One main critique of REST is that it can be inflexible at times. GraphQL enters the situation as an alternative to the mainstream and it even offers a more flexible and efficient solution than REST for fetching your data.

Let’s say for example we were attempting to fetch some data for a user. In some cases we’d find ourselves using multiple endpoints to gather the users information such as its posts and followers. Whereas with GraphQL you would simply send one Query and you’d get…


There’s been rumblings that the FED is looking to replace the dollar with a digital counterpart. In this article let’s talk about a stablecoin called the “USD Coin”.

Cryptocurrencies are leading the charge for a decentralized world. They’re known for being protected from inflation, secure, and unfortunately extremely volatile. However, with the introduction of stablecoins there are ways to mitigate this issue.

Investopedia’s definition of stablecoins is that they’re a new class of cryptocurrencies that attempts to offer price stability and are backed by a reserve asset. Stablecoins have gained traction as they attempt to offer the best of both worlds — the instant processing and security or privacy of payments of cryptocurrencies, and the volatility-free stable valuations of fiat currencies. Tether is known as one of the…


In this article I’ll be going over a JavaScript solution to a leetcode hard question that’s asking us to find the median of two sorted arrays. The problem is as follows:

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

So for example if we were given the following inputs we should get an output that displays the median.

Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000

To get to our solution the first thing I’d do is merge the two arrays. Once the arrays have been…


TypeScript was created by Microsoft in 2011 and has been a hit ever since. Many large projects and enterprise applications have utilized it in their front end. TypeScript is also interchangeable with JavaScript. This makes it a great language to learn if you already know JavaScript. TypeScript is a pleasure for larger projects due to the fact that it has static typing. Static typing allows programmers to catch errors much quicker. Often with Vanilla JavaScript errors will only show up during run time. However, with TypeScript these errors can be weeded out before running your code. …


Prerequisites

Before building your API make sure you have Node.js and MongoDB installed and setup on your machine before starting this tutorial. The complete code can be found here.

Initial Setup

Let’s get started by first opening up our terminal and creating a folder for our API. I chose to name my folder node-practice but feel free to name it whatever you’d like.

mkdir node-practice

Then cd into your folder and open it in your text editor. I’ll be using VSCode for this tutorial. Next initialize the package.json file.

npm init -y

Your package.json file will now look like this.

Vakas Akhtar

Recent graduate actively seeking full time opportunities. https://www.linkedin.com/in/vakas-akhtar-a4bb30170/

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