Closest sum partition (into two subsets) of numbers from 1 to n
Given an integer sequence 1, 2, 3, 4, ..., n. The task is to divide it into two sets A and B in such a way that each element belongs to exactly one set and |sum(A) - sum(B)| is the minimum possible. Print the value of |sum(A) - sum(B)|. Examples: Input: 3 Output: 0 A = {1, 2} and B = {3} ans |sum(A)