Pages

Sunday, June 1, 2025

Watermelon in Codeforces(It accepted at 3rd attempt!!)

 #include <iostream>

using namespace std;




int main() {

    int watermelon;

    cin >> watermelon;


    

    if(watermelon == 2) {

        cout << "NO" << endl;

    }

    else if(watermelon%2==0) { // even no;

        cout << "YES" << endl;

    }else { // odd no.

        cout << "NO" << endl;

    }

    

    return 0;

}

No comments:

Post a Comment

Contains duplicate - using HashSet (optimized code)

  class Solution {     public boolean containsDuplicate ( int [] nums) {         HashSet< Integer > seen = new HashSet<>()...