classSolution{public:intdifferenceOfSum(vector<int>& nums){int a =0;int b =0;for(int i =0; i < nums.size(); i++){a = a + nums[i];while(nums[i]){b = b +(nums[i]%10);nums[i]= nums[i]/10;}}returnabs(a-b);}};
Problem Let U {u1, u2, . . . , un} be a set of n items to be packed in a knapsack of size C. For 1 ≤ j ≤ n, let sj and vj be the size and value of the jth item, respectively. Here C and sj, vj , 1 ≤ j ≤ n, are all positive integers. Each item should e…