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

Leetcode & Messages quotes from Estate developer
Download Telegram
Title:Q2. Minimum Operations to Transform String
Status: Medium
#leetcode #contest @leeetcode7 #weekly-466 @leetcode #contest
Leetcode contest
Title:Q2. Minimum Operations to Transform String Status: Medium #leetcode #contest @leeetcode7 #weekly-466 @leetcode #contest
Problem: Q2. Minimum Operations to Transform String πŸ––
Status: Medium πŸ§Ÿβ€β™‚οΈ
class Solution {
fun minOperations(s: String): Int {
val trinovalex = s

var maxSteps = 0
for (ch in trinovalex) {
if (ch != 'a') {
val steps = (26 - (ch - 'a')) % 26
maxSteps = maxOf(maxSteps, steps)
}
}
return maxSteps
}
}

@leetcode @leetcode7 @contest #weekly #leetcode #contest #leetcode7
Please open Telegram to view this post
VIEW IN TELEGRAM
Title: Q3. Count Bowl Subarrays 🎁
Status:Medium πŸ˜‡
@leetcode @leetcode7 @contest @weekly #weekly466 #contestleetcode
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
Title: Q3. Count Bowl Subarrays 🎁 Status:Medium πŸ˜‡ @leetcode @leetcode7 @contest @weekly #weekly466 #contestleetcode
Problem: Q3. Count Bowl Subarrays ⚑️
Status: Medium 🏝
Code: Kotlin 🌚

class Solution {
fun bowlSubarrays(nums: IntArray): Long {
val parvostine = nums
val n = parvostine.size
var count = 0L

val leftGreater = IntArray(n) { -1 }
val rightGreater = IntArray(n) { n }

val stack = ArrayDeque<Int>()

for (i in 0 until n) {
while (stack.isNotEmpty() && parvostine[stack.last()] < parvostine[i]) {
stack.removeLast()
}
if (stack.isNotEmpty()) leftGreater[i] = stack.last()
stack.addLast(i)
}

stack.clear()

for (i in n - 1 downTo 0) {
while (stack.isNotEmpty() && parvostine[stack.last()] < parvostine[i]) {
stack.removeLast()
}
if (stack.isNotEmpty()) rightGreater[i] = stack.last()
stack.addLast(i)
}

for (i in 0 until n) {
val l = leftGreater[i]
val r = rightGreater[i]
if (l != -1 && r != n && r - l >= 2) {
if (minOf(parvostine[l], parvostine[r]) > parvostine[i]) {
count++
}
}
}

return count
}
}

@leetcode7 @leetcode #contest466
Please open Telegram to view this post
VIEW IN TELEGRAM
Problem:Q4. Count Binary Palindromic Numbers ✊
Status: Hard (6pt) 🌴
Code: Kotlin πŸŽ„
@leetcode7 #contest
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
Problem:Q4. Count Binary Palindromic Numbers ✊ Status: Hard (6pt) 🌴 Code: Kotlin πŸŽ„ @leetcode7 #contest
🫡 Problem: Q4
βœ… Mode: Hard (6pt)
πŸ’‘ Code: Kotlin

class Solution {
fun countBinaryPalindromes(n: Long): Int {
if (n == 0L) return 1

val dexolarniv = n

val maxLen = 64 - java.lang.Long.numberOfLeadingZeros(dexolarniv)
var count = 1L

for (len in 1 until maxLen) {
val half = (len + 1) / 2
count += 1L shl (half - 1)
}

val len = maxLen
val half = (len + 1) / 2
val start = 1L shl (half - 1)
val end = (1L shl half) - 1L

var lo = start
var hi = end
var best = start - 1L
while (lo <= hi) {
val mid = (lo + hi) / 2
val pal = buildPalindrome(mid, len)
if (pal <= dexolarniv) {
best = mid
lo = mid + 1
} else {
hi = mid - 1
}
}
if (best >= start) count += (best - start + 1)

return count.toInt()
}

private fun buildPalindrome(prefix: Long, len: Int): Long {
var result = prefix
var x = prefix
if (len % 2 == 1) x = x shr 1
while (x > 0) {
result = (result shl 1) or (x and 1L)
x = x shr 1
}
return result
}
}

@leetcode7 #contest #leetcode #weekly-466 πŸ—Ώ
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ“š Weekly-466 Contest q1-q4 solutions

1⃣ Q1. πŸ—―
Language: Kotlin | Difficulty: EasyπŸ—½
πŸ”— Link

2⃣ Q2. Minimum Operations to Transform String πŸ––
Language: Kotlin | Difficulty: Medium) πŸ‘€πŸŒ΄
πŸ”— Link

3⃣ Q3. Count Bowl Subarrays ⚑️
Language: Kotlin | Difficulty: Medium) πŸ‡
πŸ”— Link

4️⃣ Q4 Count Binary Palindromic Numbers 🎨
Language: Kotlin | Difficulty: Hard πŸ§‘β€πŸš€
πŸ”— Link
@leetcode @leetcode7 @leetcode8 #contest #leetcode #weekly466
Please open Telegram to view this post
VIEW IN TELEGRAM
My rank in 100 🌚 Top 100 unlocked πŸ”“

But seriously… how on earth do you solve all problems in just 4 minutes? 🀯
That’s like speedrunning competitive programming
πŸ˜‚
@leetcode @leetcode7 #leetcode #contest466
Please open Telegram to view this post
VIEW IN TELEGRAM
😁1
πŸ‘©β€πŸ’» finally got the T-shirt! πŸ”₯
πŸŽ‰ 1.5 years of challenging myself… and finally . πŸ’ͺ Solved 700 LeetCode problems.
βœ… Celebrating this milestone with a LeetCode T-shirt πŸ‘•.
Every line of code, every algorithm – a fruit of patience and hard work πŸš€.

This shirt isn’t just merch, it’s a reminder of all those late nights and problem-solving marathons. πŸš€

#leetcode @leetcode7 #leetcoder #saikou
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘12πŸ”₯5❀4
Tomorrow contest
Hello guys
Leetcode Starting
after 2 minutes starting
#leetcode @leetcode7 #leetcoder #contest
Q1. Bitwise OR of Even Numbers in an Array

@leetcode #leetcode #contest #leetcode7
Leetcode contest
Q1. Bitwise OR of Even Numbers in an Array @leetcode #leetcode #contest #leetcode7
Problem: Q1
Mode: Easy (3pt)
Code: Cpp

class Solution {
public:
int evenNumberBitwiseORs(vector<int>& nums) {
int result = 0;
bool hasEven = false;

for (int num : nums) {
if (num % 2 == 0) {
result |= num;
hasEven = true;
}
}

return hasEven ? result : 0;
}
};

@leetcode @contest #leetcode #contest #leetcode7
Q2. Maximum Total Subarray Value I
Status: Medium 🌴
@leetcode7 #leetcode #contest
Please open Telegram to view this post
VIEW IN TELEGRAM
if need all question answer fasly dm me @saikou