SETTER: Abdul , Harsh , camypaper , Aditya TESTER: Kmcode

Code Monk (Segment Tree,RMQ,Lazy Propagation)

Challenge Over

OPENS AT: Sep 30, 2015, 10:30 AM

CLOSES ON: Sep 30, 2015, 01:30 PM


Social Share


We started CodeMonk with an aim to offer a common platform for developers to clear their concepts and practice topics related to algorithmic programming. So far more than 13,000 people are registered for it and has attracted participation from programming community all around the globe.

As a part of the series, we send out a programming tutorial every week to registered users. Each tutorial is followed by a short programming challenge next Wednesday. You can access all the previous CodeMonk tutorials and find information about upcoming CodeMonk tutorials here -

Practice and practice hard, and you will be well on your way to becoming a master computer programmer!

Author: Akash Sharma
Problem Setters : Akash Agarwall
Problem Tester: Koichi Namketa
Editorialist: Utkarsh Saxena

Also, top 3 newbie winners to get HackerEarth T-shirts in each Code Monk challenge!

Here is this week's tutorial on Segment Tree, RMQ, Lazy Propagation -

RSVP at:
Note - Participants of this Code Monk Segment Tree , RMQ, Lazy Propagation will be automatically registered for the rest of the Code Monk Series.

The idea of Code Monk is to encourage beginners to improve their programming skills and learn about new topics. Hence the prizes that in Code Monk challenges is not based on the rankings of the leaderboard. We use the following 2 criteria while deciding who is eligible for a prize

  1. First time winner - if someone has already been given a prize, they are not awarded again. The intention is to encourage new people.
  2. Beginner programmer - you might be new to Code Monk but we also like to encourage people who are relatively new to programming itself. To determine this we look at the participants profile, their past activity and their coding profile on other sites.

The winners are decided by Code Monk team based on the above two criteria.


Second problem's statement is now updated for the first query.


  1. For the programming questions in the test, you need to choose one language from the given list and attempt.
  2. All inputs for the programming problem are from STDIN and outpu...
View All Notifications