Closest sum partition ( into two subsets ) of numbers from 1 to n | Java implementation of the approach ; Function to return the minimum required absolute difference ; Driver code
class GFG { static int minAbsDiff ( int n ) { int mod = n % 4 ; if ( mod == 0 mod == 3 ) { return 0 ; } return 1 ; } public static void main ( String [ ] args ) { int n = 5 ; System . out . println ( minAbsDiff ( n ) ) ; } }