ar
Feedback
OA Help : Interview Help

OA Help : Interview Help

الذهاب إلى القناة على Telegram

Codeforces Codechef Leetcode AtCoder GFG CodeStudio All Contests Solutions available.

إظهار المزيد
898
المشتركون
لا توجد بيانات24 ساعات
-47 أيام
-1430 أيام
أرشيف المشاركات
Use LLONG_MAX if you are using INT_MAX

lol
lol

if (n % 3) cout << "First\n"; else cout << "Second\n"; // A

Get ready for Codeforces Div. 3 🔥

D solution Step 1 Push all elements in a single Vector step 2 Sort it step 3 consider 1-indexing and multiply each element with its index and add them

class Solution { public: long long maxSpending(vector>& values) { vector items; for (const auto& it : values) { for (int x : it) { items.push_back(x); } } sort(items.begin(), items.end()); long long ans = 0; long long d = 1; for (int x : items) { ans += d++ * static_cast(x); } return ans; } }; // D

https://leetcode.ca/2023-11-09-2927-Distribute-Candies-Among-Children-III/ Posted 2 days ago Questions pehle hi out hogye the 😂

class Solution { public: long long distributeCandies(int n, int limit) { auto comb2 = [](int n) { return 1LL * n * (n - 1) / 2; }; if (n > 3 * limit) { return 0; } long long ans = comb2(n + 2); if (n > limit) { ans -= 3 * comb2(n - limit + 1); } if (n - 2 >= 2 * limit) { ans += 3 * comb2(n - 2 * limit); } return ans; } }; // A and B both

photo content

A and B done ✅ Leetcode

LOL Rank
LOL Rank

Dm me fast 😍

photo content

D done ✅

C done ✅

photo content

B done ✅

A done ✅ Codeforces

D done 🙋🏻‍♂️

C done