Possibly, someone called "MO" once used the trick in a local contest, and the name stuck and later got popular. I have never encountered the name "Mo's algorithm" outside of competitive programming.

The technique, or the term "Mo's Algorithm" ("莫隊算法" in Chinese) was originally thought of and popularized by 莫涛 (Mo Tao) and his teammates. It was first used to tackle a problem from 2009 China IOI Camp: 小Z的袜子(hose) — authored by 莫涛 himself. The problem was: given a sequence of integers, for any given interval, calculate the probability of choosing any 2 numbers and the 2 numbers are equal.

Now let's start. I have here compiled the tutorial, some articles written by me, and problems on Mo's algorithm.

### Basic problems:

I have written some basic articles on Mo's algorithm which has been published on Geeksforgeeks.

### List of problems:

Edit:

Thanks for the upvotes! It means a lot to me

• +243

| Write comment?
 » 4 years ago, # |   +4 great research saurabhyadavz.
 » 4 years ago, # |   +6 There must be a bookmark option to save such blogs .
•  » » 4 years ago, # ^ |   +8 Well said. These awesome blogs must be bookmarked.
•  » » » 4 years ago, # ^ |   +1 Just as awesome as your editorials xD
•  » » 4 years ago, # ^ |   +20 There is a bookmark option. You can click star near upvote and downvote buttons and this blog will be added to your favourite blogs. You can watch them in your profile or using this link.
 » 4 years ago, # |   +16 Mo is someone's name, writing "Mo's algorithm" makes more sense, no capital O. Where did that come from anyway?
•  » » 4 years ago, # ^ |   +3 Thanks for pointing out though. I think it comes from China.
•  » » » 4 years ago, # ^ |   +14 The algorithm of course comes from China ;), but somehow I doubt the capital-O spelling comes from there.
•  » » » » 4 years ago, # ^ |   0 It’s MO’s in order to capitalize on the big O runtime.
 » 4 years ago, # |   -16 I remember a time when I was stuck in a question in Codechef Long Challenge. This blog is really gonna help all.
•  » » 4 years ago, # ^ |   0 Yes it was Factor Tree. Really challenging problem and one of the best Long Challenge I ever faced.
 » 4 years ago, # | ← Rev. 2 →   +3 Hey dude, nice blog! Thanks a lot. Just wondering what made you think the part you have written after edit!
 » 3 years ago, # |   +3 For MO's Algo on trees, how to find the LCA of two nodes??
 » 13 months ago, # |   0 The page https://blog.anudeep2011.com/mos-algorithm/ doesn't load for me. Does this work for someone else?