I have a set of data in SQL that looks like below:

```
╔═══════════╦═══════╗
║ TimeStamp ║ State ║
╠═══════════╬═══════╣
║  7:10 AM  ║   A   ║
║  7:11 AM  ║   A   ║
║  7:12 AM  ║   A   ║
║  7:13 AM  ║   B   ║
║  7:14 AM  ║   B   ║
║  7:15 AM  ║   A   ║
║  7:16 AM  ║   A   ║
║  7:17 AM  ║   C   ║
║  7:18 AM  ║   C   ║
╚═══════════╩═══════╝

```

I am trying to calculate the time duration for each state. However, I want to separate each sequence of states and calculate the difference for them separately, separating the states that repeat as well. So I want the above data to return something like below:

```
╔═══════╦════════════════════╗
║ State ║ Duration (minutes) ║
╠═══════╬════════════════════╣
║   A   ║         2          ║
║   B   ║         1          ║
║   A   ║         1          ║
║   C   ║         1          ║
╚═══════╩════════════════════╝

```

Could someone please help? How can I write a SQL query that returns me this data?

Thank you!