### Problem Link : Contest Practice

**Author and Editorialist :** Arun Prasad

### DIFFICULTY:

EASY

### PREREQUISITES:

Segment Trees

### PROBLEM:

Given the range of indexes print the difference between the largest and smallest value in the given range

### EXPLANATION:

Create a segment tree for the given array, for each node in the segment tree maintain two variable, one for the smallest value in the sements range and other one for largest value in the segments range.