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

Leetcode & Messages quotes from Estate developer
Download Telegram
Goo ?
anyone have?
Please open Telegram to view this post
VIEW IN TELEGRAM
tomorrow contest
Hello Guys
Someone start contest ?
Dm : @saikou
Q1. Generate Tag for Video Caption
Mode :Easy
Example 1:

Input: caption = "Leetcode daily streak achieved"

Output: "#leetcodeDailyStreakAchieved"

Explanation:

The first letter for all words except "leetcode" should be capitalized
I will start contest with Kotlin šŸ—æ #contest #leetcode #leetcode7
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
Q1. Generate Tag for Video Caption Mode :Easy Example 1: Input: caption = "Leetcode daily streak achieved" Output: "#leetcodeDailyStreakAchieved" Explanation: The first letter for all words except "leetcode" should be capitalized
Status: Done āœ…
Code:Kotlin
IDLE : Intellij

Code :

class Solution {
fun generateTag(caption: String): String {

val words = caption
.split("\\s+".toRegex())
.map { it.filter(Char::isLetter) }
.filter(String::isNotEmpty)


val camel = words
.mapIndexed { idx, w ->
w.lowercase().let { low ->
if (idx == 0) low
else low.replaceFirstChar { it.uppercaseChar() }
}
}
.joinToString("")


return ("#$camel").take(100)
}
}


@leetcode7
#leetcodecontest #leetcode #contest
Please open Telegram to view this post
VIEW IN TELEGRAM
Q2. Count Special Triplets
Status: Medium
#leetcodecontest #leetcode #contest
Leetcode contest
Q2. Count Special Triplets Status: Medium #leetcodecontest #leetcode #contest
šŸ”Œ Problem Explanation:

We have an integer array nums of length n. A special triplet is a triple of indices (i, j, k) such that:
0 <= i < j < k < n

nums[i] == 2 * nums[j]

nums[k] == 2 * nums[j]


We want to count how many such triplets there are, and return the result modulo 10**9+7 (to avoid overflow).

#leetcodecontest #leetcode #contest
Easy šŸ—æ
Q2 Solved šŸ—æ
Code šŸ§‘ā€šŸ’»: Kotlin
IDLE: Intellij

class Solution {
fun specialTriplets(nums: IntArray): Int {
val MOD = 1_000_000_007L
val n = nums.size
val maxVal = nums.maxOrNull() ?: 0
val limit = maxVal * 2

val rightCount = LongArray(limit + 1)
val leftCount = LongArray(limit + 1)
for (v in nums) rightCount[v]++

var result = 0L
for (j in nums.indices) {
val mid = nums[j]
rightCount[mid]--

val t = mid * 2
if (t <= limit) {
result = (result + leftCount[t] * rightCount[t]) % MOD
}

leftCount[mid]++
}

return result.toInt()
}
}

@leetcode7 #leetcodecontest #leetcode #contest
Please open Telegram to view this post
VIEW IN TELEGRAM
Let's get to 250 subscribers and I'll share the rest.
@leetcode7 #leetcodecontest #leetcode #contest @azamovme @leetcode #q1 #q2 #q3 #q4
Leetcode contest
tomorrow contest
History will back )
🤩
Please open Telegram to view this post
VIEW IN TELEGRAM
šŸ”„3
āœˆļø
Please open Telegram to view this post
VIEW IN TELEGRAM
asm4-guide.pdf
1.3 MB
Someone know asm smali ?
Anyone start to contest?
Problem Q1. Partition String

You are given a string s of lowercase English letters. You must split s into a sequence of substrings (segments) so that each segment is the shortest possible string, starting at the current position, that has never appeared among the previously chosen segments.

segment = s[i … i+L–1]
#leetcode #contest #leetcode7 @leetcode7