1class Solution {2public:3int travel(vector<vector<int>> &tr, int lvl, int ind) {4if (ind >= tr[lvl].size()) // To check if we are going out of bound5return INT_MAX;67if (lvl == tr.size() - 1) { // Return if we are on last line8return tr[lvl][ind];9}1011int s = travel(tr, lvl + 1, ind); // Go South12int se = travel(tr, lvl + 1, ind + 1); // Go South East1314// Return the minimum of south and south east + cost of the index we are15// currently at.1617return min(s, se) + tr[lvl][ind];18}1920int minimumTotal(vector<vector<int>> &triangle) {21return travel(triangle, 0, 0);22}23};