Printing Neatly

Consider the problem of neatly printing a paragraph with a monospaced font (all characters having the same width) on a printer. The input text is a sequence of n words of lengths l1, l2,…,ln, measured in characters. We want to print this paragraph neatly on a number of lines that hold a maximum of M characters each. Our criterion of “neatness” is as follows. If a given line … Continue reading Printing Neatly

Donut: unsupervised anomaly detection using VAE

In this post, we are going to use Donut, an unsupervised anomaly detection algorithm based on Variational Autoencoder which can work when the data is unlabeled but can also take advantage of the occasional labels when available. In particular, we are going to focus on detecting anomalies on time series KPIs (key performance indicators) which are time-series data, measuring metrics such as the number of … Continue reading Donut: unsupervised anomaly detection using VAE

Balancing a cart pole with policy gradients algorithm

In this post we are going to analyze a type of reinforcement learning algorithm called policy gradients. In the field of reinforcement learning, we have an agent making observations and taking actions within an environment in order to receive some rewards and its main objective is to learn a policy such that its actions will maximize its expected long-term rewards. In this case, our agent … Continue reading Balancing a cart pole with policy gradients algorithm

GAN: Generative Adversarial Networks

Imagine a scenario where a forger attempts to produce fake currencies and the policeman has to try to distinguish those fake currencies from the real ones. At the beginning, both don’t have much experience, the forger will just come with a piece of paper with a dollar bill scribbled on it. Obviously, is that is a fake currency, but the unexperienced policeman still will struggle … Continue reading GAN: Generative Adversarial Networks

Predicting players’ departure in MMORPGs

MMORPG’s business model Nowadays, MMORPGs are so popular that their market is worth over a billion dollars in 2019 and it is expected to keep growing during the following years. They can count over 10 million active monthly players, and, as expected, their huge base of players is one the keys to their success. In fact, these kinds of games belong to the (FTP) Free-To-Play … Continue reading Predicting players’ departure in MMORPGs

Count of Range Sums

Given an integer array nums, return the number of range sums that lie in [lower, upper] inclusive. Range sum S(i, j) is defined as the sum of the elements in nums between indices i and j (i ≤ j), inclusive. A naïve algorithm of O(n2) is trivial. You MUST do better than that. Difficulty: Very hard. Input The first line contains 3 integers separated by spaces: n, representing the length of the integer array nums. lower. upper. The second line is the integer … Continue reading Count of Range Sums