Блог пользователя HuTao_Oya_OyaOya

Автор HuTao_Oya_OyaOya, история, 7 недель назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор HuTao_Oya_OyaOya, история, 2 месяца назад, По-английски
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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор HuTao_Oya_OyaOya, история, 2 месяца назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор HuTao_Oya_OyaOya, история, 2 месяца назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится