Pascals triangle

how to solve this problem without using function???

With this logic you can solve. This is the best logic I have ever see of Pascal triangle. Use pen and paper for understanding the code

vector<vector> result;
vector<int> row;
for (int i = 0; i < n; i++) 
{
	row.push_back(1);
	for (int j = i - 1; j > 0; j--) 
		row[j] = row[j - 1] + row[j];
	result.push_back(row);
}
return result;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.