For the past few months, I’ve been working on an application that is responsible for processing in-memory data. The project is exciting to me for two reasons. One is that the project is written entirely in Rust, and the other is the opportunity to learn about new topics and libraries. This article explores what I have learned while working with Apache Arrow.
When I first started working on the project, I was not aware of Apache Arrow. I just needed a way to aggregate data as efficiently as possible. I even built a proof-of-concept that provided most of the functionality…
GraphQL is a very popular framework for developing client-facing APIs. This article covers the basics of integrating GraphQL with Rust including designing a code-first schema, setting up a GraphQL server, and implementing custom resolvers and mutations.
The idea for this article spawned from what I’ve been doing at work recently. I normally spend my time writing Rust code, but I’ve recently been working with GraphQL in a TypeScript environment. …
The CSV file format is a very common method for storing tabular data. This article covers the basics of reading and writing CSV files, (de)serializing CSV data using the Serde library, and wraps up with a sample data aggregation example.
The idea for this article came about because I needed a fast and convenient way to work with CSV formatted data. One option was to write my own library, but I didn’t feel like that was a convenient solution. So, after a bit of research, I decided to use the csv crate authored by Andrew Gallant. …
There are two sorted arrays
nums2 of size
m respectively. Find the median of the two sorted arrays. You may assume
nums2 cannot both be empty.
nums1 = [1, 3] nums2 =  The median is 2.0
nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5
Since both input arrays are already sorted, a naive solution would be to merge the arrays by iterating through each and inserting the items into a new array. Then calculate the median.
initialize i and j to 0
initialize length of new…
Given a string, find the length of the longest sub-string without repeating characters.
Explanation: The answer is "abc", with the length of 3.
Explanation: The answer is "b", with the length of 1.
Explanation: The answer is "wke", with the length of 3. Note that the answer must be a sub-string, "pwke" is a sub-sequence and not a sub-string.
One thing to note is that Rust does not implement traditional string indexing due to issues that come up with utf-8 encodings. There are a few approaches to get…
A sample project that uses Warp and Tokio to build a simple asynchronous API.
This tutorial introduces the Warp framework by building an asynchronous CRUD API. I wrote this with the following goals in mind:
Before getting into any coding, I’ll sketch out the design of the API. This will help with determining the necessary endpoints, handler functions, and how to store data.
For this API, I only need two routes.
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
Before this problem can be solved we need to talk about the data structure. If you are already familiar with linked…
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice.
Given nums = [2, 7, 11, 15], target = 9, Because nums + nums = 2 + 7 = 9, return [0, 1].
The naive approach to solving this problem is to loop through each element
nums and then loop through each element again to find if there is a value that equals