1
// ��������Please upvote if it helps ��������4
vector<string> summaryRanges(vector<int> &nums) {9
// if size happens to be zero return empty string10
if (n == 0) return result;12
// assigning first element to a15
for (int i = 0; i < n; i++) {16
// if one of both is true17
if (i == n - 1 || nums[i] + 1 != nums[i + 1]) {18
// if current element is not equals a19
// this means we have found a range.20
if (nums[i] != a) result.push_back(to_string(a) + "->" + to_string(nums[i]));22
// this means we have reached to the end of string and now23
// we have to add a that should be the last element25
result.push_back(to_string(a));27
// checking for this condition so that a got updated for next range28
// also n-1 so that a doesn't contain out of bound value29
if (i != n - 1) a = nums[i + 1];