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

3917. Count Indices With Opposite Parity (Brute Force) O(n2) + Optimized Solution O(n) + tips LEETCODE WEEKLY 500

  class Solution {     public int [] countOppositeParity ( int [] nums ) {          // approach 1 - checks every pair         int n = n...