Leetcode contest
565 subscribers
176 photos
7 videos
2 files
59 links
Main channel @azamovme

Leetcode & Messages quotes from Estate developer
Download Telegram
Q4. Count Subarrays With Majority Element II
#leetcode #contest
Leetcode contest
Q4. Count Subarrays With Majority Element II #leetcode #contest
Q4. Count Subarrays With Majority Element II
Code: Java
Status: Hard

class Solution {
public long countMajoritySubarrays(int[] nums, int target) {
int n = nums.length;

int offset = n + 1;
int size = 2 * n + 5;
long[] bit = new long[size];

int[] melvarion = nums;

long ans = 0L;
int pref = 0;

add(bit, pref + offset, 1L);

for (int x : melvarion) {
pref += (x == target ? 1 : -1);

ans += sum(bit, (pref + offset) - 1);

add(bit, pref + offset, 1L);
}

return ans;
}

private void add(long[] bit, int idx, long delta) {
for (int i = idx; i < bit.length; i += i & -i) {
bit[i] += delta;
}
}

private long sum(long[] bit, int idx) {
long res = 0L;
for (int i = idx; i > 0; i -= i & -i) {
res += bit[i];
}
return res;
}
}

@leetcode7 #contest #leetcode
i just solved tomorrow questions . so i didnt do something just i extracted all 4 weeks leetfcode questions database
Tomorrow Contest #leetcode #weekly i will participate
Forwarded from Sozo App
Hello everyone 👋, there is no current DMCA issue. I have proactively updated several channel permissions to avoid potential DMCA concerns 🪦. If you can advise on optimal prevention measures, write it in the comments 💬 . Please contact me if this affects your access 📭

Thanks for all ☺️
Please open Telegram to view this post
VIEW IN TELEGRAM
Death is not the enemy. A wasted life is.

William Mulligan 🤫
Please open Telegram to view this post
VIEW IN TELEGRAM
5
Leetcode contest
Photo
This media is not supported in your browser
VIEW IN TELEGRAM
I’m not here to impress — I’m here to express what they wish they could say.
Eminem
Who knows HTML? 😁
Please open Telegram to view this post
VIEW IN TELEGRAM
😁2
Director Gore Verbinski says AI is attacking modern storytelling.

“Instead of trying to solve cancer or take us to Mars or these things that could solve some genuine issues, it’s going after storytelling, it’s going after illustrations, it’s gonna write your song for you. It’s like saying it’s gonna breathe for you, it’s gonna f*ck for you. It’s gonna take away.” @leetcode
3
Forwarded from azmv
“Overthinking” is an excuse for inaction.
Today contest #leetcode
Leetcode contest
Today contest #leetcode
Weekly contest @leetcode3 lets pray for me for joining
Hello everyone, I’m back after a 3-week vacation. I’m ready to start running the channel again. Thanks to all the new members for joining! 🥂
Please open Telegram to view this post
VIEW IN TELEGRAM
http4k — a set of functional tools for HTTP applications

http4k is a lightweight yet fully functional toolkit for working with HTTP, written in pure Kotlin.

http4k allows you to write applications as simple Kotlin functions. For example, here is a simple echo server:

 val app: HttpHandler = { request: Request -> Response(OK).body(request.body) }
val server = app.asServer(SunHttp(8000)).start()

@KotlinSenior