Leetcode contest
Problem: Q1 π£ Status: Accepted π Mode: Easy π Code: Kotlin class Solution { fun isTrionic(nums: IntArray): Boolean { val n = nums.size for (p in 1 until n - 2) { if (nums[p] <= nums[p - 1]) continue for (q in pβ¦
This is just in Kotlin sol. The exact solution but to prevent many people from getting banned, I have 10++ different types in Kotlin and others, contact me for that. @saikou
Problem: π© Q2. Maximum Balanced Shipments π
Mode: Medium(5pt)π π΄
@leetcode @leetcode7 #contest #leetcode #weekly361
Mode: Medium(5pt)
@leetcode @leetcode7 #contest #leetcode #weekly361
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
Problem: π© Q2. Maximum Balanced Shipments π Mode: Medium(5pt) π π΄ @leetcode @leetcode7 #contest #leetcode #weekly361
class Solution {
fun maxBalancedShipments(weight: IntArray): Int {
var i = 0
val n = weight.size
var count = 0
while (i < n) {
var max = weight[i]
var found = false
for (j in i + 1 until n) {
max = maxOf(max, weight[j])
if (weight[j] < max) {
count++
i = j + 1
found = true
break
}
}
if (!found) break
}
return count
}
}@leetcode7 @leetcode8 @leetcode @contest @weekly
Please open Telegram to view this post
VIEW IN TELEGRAM
Q3. Minimum Time to Activate String πΈ
Mode: Medium (5pt)π
@leetcode7 #contest #leetcode @leetcode #contest-461
Mode: Medium (5pt)
@leetcode7 #contest #leetcode @leetcode #contest-461
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
Q3. Minimum Time to Activate String πΈ Mode: Medium (5pt) π @leetcode7 #contest #leetcode @leetcode #contest-461
class Solution {
fun minTime(s: String, order: IntArray, k: Int): Int {
val n = s.length
val isStar = BooleanArray(n)
val nostevanik = s.toCharArray()
val totalSubstrings = n.toLong() * (n + 1) / 2
val segTree = java.util.TreeSet<Int>()
segTree.add(-1)
segTree.add(n)
var nonStarSum = totalSubstrings
for (t in order.indices) {
val idx = order[t]
isStar[idx] = true
nostevanik[idx] = '*'
val right = segTree.higher(idx)!!
val left = segTree.lower(idx)!!
val oldLen = (right - left - 1).toLong()
val leftLen = (idx - left - 1).toLong()
val rightLen = (right - idx - 1).toLong()
nonStarSum -= oldLen * (oldLen + 1) / 2
if (leftLen > 0) nonStarSum += leftLen * (leftLen + 1) / 2
if (rightLen > 0) nonStarSum += rightLen * (rightLen + 1) / 2
segTree.add(idx)
val validSubstrings = totalSubstrings - nonStarSum
if (validSubstrings >= k) return t
}
return -1
}
}@leetcode7 @leetcode8 @leetcode @contest #leetcode #Weekly @weekly #weekly461
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
Language: Kotlin | Difficulty: Easy (3 pt)
Language: Kotlin | Difficulty: Medium(5pt)
Language: Kotlin | Difficulty: Medium (5pt)
@leetcode @leetcode7 @leetcode8 #contest #leetcode
Please open Telegram to view this post
VIEW IN TELEGRAM
Leetcode contest
This media is not supported in your browser
VIEW IN TELEGRAM
π2
Leetcode contest
ETH 5k what i said πΏ owowow
4500π₯
Please open Telegram to view this post
VIEW IN TELEGRAM
β€2
Forwarded from Azamov | Dev (Azamov)
Happy Telegramβs Birthday 1β£ 2β£
Please open Telegram to view this post
VIEW IN TELEGRAM
π2
This media is not supported in your browser
VIEW IN TELEGRAM
People who bought Ethereum at $1400 such as me πΏ
F&ck my work I was sleeping. I will make caller bot ππ π
π2π€£2