Neighboring Bitwise XOR | Leetcode 2683

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 17

  • @viralAdda213
    @viralAdda213 День тому +4

    good morning sir,amazing just potd is live and you have uploaded the video,hatsoff to your dedication & consistency🙏First viewer

  • @AlbinSabu-y2v
    @AlbinSabu-y2v День тому +2

    Early morning.your efforts are really appreciated ❤🎉

  • @logeshv2125
    @logeshv2125 17 годин тому

    Super explanation brother, keep going✨

  • @sailendrachettri8521
    @sailendrachettri8521 11 годин тому

    Thank you sir :)

  • @wierdo9514
    @wierdo9514 15 годин тому

    I counted the number of 1’s in the derived if their odd means false else zero 🙂

  • @godFather-123-b8g
    @godFather-123-b8g День тому +1

    question dekha nhi solution phele aa gya lol

  • @rajavignesh7216
    @rajavignesh7216 15 годин тому

    It also works by checking freq of 1 is even or not , idk y but it passed all cases😅

  • @opkrchauhan_1
    @opkrchauhan_1 22 години тому

    class Solution {
    public boolean doesValidArrayExist(int[] derived) {
    int n = derived.length;
    int ans =0;
    for(int i:derived){
    ans ^=i;
    }
    if(ans==0){
    return true;
    }
    return false;
    }
    }

  • @eshandhok2591
    @eshandhok2591 11 годин тому

    why is this wrong?
    class Solution {
    public:
    bool doesValidArrayExist(vector& d) {
    if (d.size() == 0) {
    return true;
    }
    if (d.size() == 1) {
    return !d[0];
    }
    int n = size(d);
    vector o1(n, 0), o2 = o1;
    if (d[n - 1] == 0) {
    o1[0] = 1, o2[0] = 0;
    o1[n - 1] = 1, o2[n - 1] = 0;
    } else {
    o1[0] = 0, o2[0] = 0;
    o1[n - 1] = 1, o2[n - 1] = 1;
    }
    for (int i = n - 2; i >= 1; i--) {
    if (d[i] == 1) {
    o1[i] = 0;
    o2[i] = 1;
    } else {
    o1[i] = 1;
    o2[i] = 0;
    }
    }
    return ((o1[0] ^ o1[1]) == d[0]) or ((o2[0] ^ o2[1]) == d[0]);
    }
    };