# Number of Intervals in which given value lies

**Objective:** Given a list of intervals with start and end for each interval. You have given a value V, write an algorithm to find the number of intervals in which the value V lies.

**Example:**

Given Interval: [[1,7], [3,10], [12,15]] Value : 6 lies in Intervals: 2 Given Interval: [[1,7], [3,10], [12,15]] Value : 11 lies in Intervals: 0

**Approach:**

- Input: list of intervals and value
.*V* - Initialize
= 0.*count* - Iterate through the intervals, for each
interval*current*- Check if
lies in the current intervals mean*V*and*start_of_current<=V*, increment the count.*end_of_current>=V*

- Check if
- Return the
.*count*

**Complete Code:**

**Output:**

Given Interval: [[1,7], [3,10], [12,15]] Value : 6 lies in Intervals: 2