HuTao_Oya_OyaOya's blog

By HuTao_Oya_OyaOya, history, 4 months ago, In English

Problem Link

Problem in short : Find sum of XOR of all subarrays of size>1 in the given array of size n in linear time.

My idea is to get the prefix sum array of XORs and now the problem is reduced to finding XOR between all possible pairs in prefix XOR array.

I tried for hours to debug the code but couldn't figure out what did I do wrong. Any help would be greatly appreciated.

Old Code

UPD :

AC
What was the problem earlier ?

Thanks srinivas1999 xQConqueror vaibhav2740

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By HuTao_Oya_OyaOya, history, 4 months ago, In English
Problem Statement
Optimal Code

Link to the problem on GFG

Doubt: Can anyone explain to me how this code is working practically while theoretically O(1e4*1e5) should give TLE.

Is there any mathematically reason ?

Thanks for your time.

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By HuTao_Oya_OyaOya, history, 4 months ago, In English

Given an m x n binary matrix matrix, return the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1.

Code:

Queries:

Q1
Q2
Q3

Thanks for your time.

Full text and comments »

By HuTao_Oya_OyaOya, history, 4 months ago, In English

How to get the new ideas & When should I look at the editorial. (You can avoid spoilers, not a must read)

I tried hard to solve the Problem G

I've spent 30 minutes trying it, and I'm already out of ideas.

My fear

What I usually try to do is "I will try for another 15-20 minutes then I will try again tomorrow and I will look at the editorial."

Any slight hints/ideas or anything on how to face the situation that I'm facing these days would be greatly appreciated.

My Goal
Sorry

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it