online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#User function Template for python3 class Solution: def minDifference(self, arr, n): # code here s = 0 s = sum(arr) mat = [[0]*(s+1) for i in range(n+1)] for i in range(n): for j in range(s): if i==0: mat[i][j] = 0 if j==0: mat[i][j] = 1 for i in range(1,n+1): for j in range(1,s+1): if arr[i-1]<=j: mat[i][j] = mat[i-1][j] or mat[i-1][j-arr[i-1]] else: mat[i][j] = mat[i-1][j] mn = 10**7 for i in range(s//2,-1,-1): if mat[n][i]==1: mn = s-2*i break print("minimum subset sum Difference is : ",mn) if __name__ == '__main__': print("Enter the array:") arr = list(map(int, input().split())) n = len(arr) ob = Solution() ans = ob.minDifference(arr, n) ans # } Driver Code Ends

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue