Untitled

mail@pastecode.io avatar
unknown
java
a year ago
507 B
10
Indexable
Never
public class BinaryDissolution {
    public static void main(String[] args) {
        String binaryNumber = "010";
        boolean result = canDissolve(binaryNumber);
        System.out.println(result); // Output: true
    }

    static boolean canDissolve(String binaryNumber) {
        int count = 0;
        for (int i = 0; i < binaryNumber.length(); i++) {
            if (binaryNumber.charAt(i) == '1') {
                count++;
            }
        }
        
        return count % 2 == 0;
    }
}